CSR-416 Move setupOrderBeforeSave to address-lookup

This commit is contained in:
Katie 2022-05-12 15:28:45 -04:00
parent 8bfdb6b50c
commit 7a511d73bc
2 changed files with 11 additions and 13 deletions

View file

@ -58,8 +58,6 @@ export async function navigateAfterSaveToHeritageFunnel(currentRoute) {
const currentComponent = currentRoute.matched[0].components;
currentComponent.default.methods.resetDependentState();
setupOrderBeforeSave();
// Create the order (or save existing order) when navigating to Heritage Funnel.
await saveOrder();
@ -144,14 +142,4 @@ function isVinRelatedPage(toRoute) {
fmgPageValue === fmgPageValues.ADDRESS_LOOKUP ||
fmgPageValue === fmgPageValues.ADDRESS_VEHICLES ||
fmgPageValue === fmgPageValues.ESTIMATE;
}
function setupOrderBeforeSave() {
const serviceLocation = store.getters.order.serviceLocation;
if (!serviceLocation.zipCode && serviceLocation.zipCode == store.getters.vehicle.registration.zipCode) {
baseMixin.methods.dispatchStoreAction(
storeActions.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION
);
}
}

View file

@ -264,6 +264,8 @@ export default {
this.displayVinLookupByHomeAddressNotAllowedAlert = false;
},
navigateForward(carEntered, carsFound) {
this.setupOrderBeforeSave();
if (carsFound.length == 1) {
// if a different vehicle is found than the one entered and the selected glass
// is not available for that vehicle
@ -334,7 +336,15 @@ export default {
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, this.serviceZipCode);
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.customerQuestions.emailAddress);
},
setupOrderBeforeSave() {
const serviceLocation = store.getters.order.serviceLocation;
if (!serviceLocation.zipCode && serviceLocation.zipCode == store.getters.vehicle.registration.zipCode) {
baseMixin.methods.dispatchStoreAction(
storeActions.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION
);
}
}
},
computed: {
AlertNonServiceableZipHeader(){