Fixing submittedOrder DNE
This commit is contained in:
parent
80b1b4749d
commit
1e3ead2470
7 changed files with 37 additions and 22 deletions
|
|
@ -24,7 +24,7 @@ export default {
|
|||
}
|
||||
|
||||
const imageUrl = (this.mainStore.hasSubmittedOrder())
|
||||
? this.mainStore.submittedOrder.vehicle.imageUrl
|
||||
? this.mainStore.getSubmittedOrder().vehicle.imageUrl
|
||||
: this.mainStore.order.vehicle.imageUrl;
|
||||
|
||||
if (!imageUrl || imageUrl === 'NULL') {
|
||||
|
|
@ -54,7 +54,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
getUnmatchedVehicleIcon() {
|
||||
const category = this.mainStore.submittedOrder?.vehicle.category ?? this.mainStore.order.vehicle.category;
|
||||
const category = this.mainStore.getSubmittedOrder()?.vehicle.category ?? this.mainStore.order.vehicle.category;
|
||||
switch (category) {
|
||||
case this.vehicleCategories.CAR:
|
||||
return this.carUnmatchedVehicleIcon;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ export default {
|
|||
},
|
||||
setup() {
|
||||
const mainStore = useMainStore();
|
||||
const { submittedOrder } = mainStore;
|
||||
const submittedOrder = mainStore.getSubmittedOrder();
|
||||
return { mainStore, submittedOrder };
|
||||
},
|
||||
data() {
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ export default {
|
|||
},
|
||||
setup() {
|
||||
const mainStore = useMainStore();
|
||||
const { submittedOrder } = mainStore;
|
||||
const submittedOrder = mainStore.getSubmittedOrder();
|
||||
return { mainStore, submittedOrder };
|
||||
},
|
||||
computed: {
|
||||
|
|
|
|||
|
|
@ -301,20 +301,31 @@ export default {
|
|||
|
||||
if (this.paymentMethod === paymentMethods.PAY_AT_TIME_OF_SERVICE) {
|
||||
try {
|
||||
await submitWorkOrder({ submitType: submitType.SAFELITE }).then(() => {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD,
|
||||
this.$route
|
||||
);
|
||||
}).catch((submitError) => {
|
||||
useMainStore().setBailout(bailoutMessage.saveSessionError(submitError.data));
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.SAVE_SESSION_FAILED,
|
||||
this.$route,
|
||||
{ query: { issPage: issPageValues.PAYMENT_METHOD } }
|
||||
);
|
||||
});
|
||||
await submitWorkOrder({ submitType: submitType.SAFELITE });
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD,
|
||||
this.$route
|
||||
);
|
||||
// await submitWorkOrder({ submitType: submitType.SAFELITE }).then(() => {
|
||||
// this.$router.navigate(
|
||||
// this.navigationScenarios.CLICKED_FORWARD,
|
||||
// this.$route
|
||||
// );
|
||||
// }).catch((submitError) => {
|
||||
// useMainStore().setBailout(bailoutMessage.saveSessionError(submitError.data));
|
||||
// this.$router.navigate(
|
||||
// this.navigationScenarios.SAVE_SESSION_FAILED,
|
||||
// this.$route,
|
||||
// { query: { issPage: issPageValues.PAYMENT_METHOD } }
|
||||
// );
|
||||
// });
|
||||
} catch (error) {
|
||||
useMainStore().setBailout(bailoutMessage.saveSessionError(submitError.data));
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.SAVE_SESSION_FAILED,
|
||||
this.$route,
|
||||
{ query: { issPage: issPageValues.PAYMENT_METHOD } }
|
||||
);
|
||||
console.error(`error: response from submit work order:${error.message}`);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ export default {
|
|||
},
|
||||
setup() {
|
||||
const mainStore = useMainStore();
|
||||
const { submittedOrder } = mainStore;
|
||||
const submittedOrder = mainStore.getSubmittedOrder();
|
||||
return { mainStore, submittedOrder };
|
||||
},
|
||||
computed: {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const routes = [
|
|||
// Intercept all navigation if a submitted order exists in storage
|
||||
if (useMainStore().hasSubmittedOrder()) {
|
||||
if (to.query.issPage !== issPageValues.ENTRY_PAGE) {
|
||||
return await GoToConfirmationPage(next, useMainStore().submittedOrder);
|
||||
return await GoToConfirmationPage(next, useMainStore().getSubmittedOrder());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -419,8 +419,7 @@ export const useMainStore = defineStore({
|
|||
experimentSettings: (state) => state.applicationUser.experiments
|
||||
.filter((x) => !!x.isActive)
|
||||
.map((x) => x.settings)
|
||||
.reduce((r, c) => Object.assign(r, c), {}) ?? {},
|
||||
submittedOrder: () => JSON.parse(window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER))
|
||||
.reduce((r, c) => Object.assign(r, c), {}) ?? {}
|
||||
},
|
||||
actions:
|
||||
{
|
||||
|
|
@ -1559,7 +1558,8 @@ export const useMainStore = defineStore({
|
|||
},
|
||||
|
||||
resetState() {
|
||||
Object.assign(this, getDefaultState());
|
||||
//Object.assign(this, getDefaultState());
|
||||
this.$reset();
|
||||
},
|
||||
|
||||
resetRegistrationState() {
|
||||
|
|
@ -2529,6 +2529,10 @@ export const useMainStore = defineStore({
|
|||
return window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER) !== null;
|
||||
},
|
||||
|
||||
getSubmittedOrder() {
|
||||
return JSON.parse(window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER));
|
||||
},
|
||||
|
||||
createSubmittedOrder(submitType) {
|
||||
if (this.hasSubmittedOrder()) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue