From 8da1c0c7c89ee813b9ce23ddcd2e6a79c8335134 Mon Sep 17 00:00:00 2001 From: Kroell Date: Fri, 20 Jan 2023 14:06:42 -0500 Subject: [PATCH] fix for mismatched vehicle - navigates to correct page --- .../license-plate-lookup.vue | 47 +++++-------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 6f825e2a..e864aae3 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -108,8 +108,6 @@ export default { vehicleFromLookup: null, licensePlate: null, licenseState: null, - registrationZipCode: null, - serviceZipCode: this.serviceZipCode, displayVinNotFoundAlert: false, displayMatchedDifferentVehicleAlert: false, previouslyEnteredCarId: "", @@ -123,7 +121,7 @@ export default { return this.mainStore.order.vehicle.carId !== null; }, loadDefaultsFromStore() { - this.customerQuestions = this.mainStore.customerData.addressQuestions.zipCode; + this.customerQuestions = this.mainStore.customerData.addressQuestions.state; }, backButtonAction() { // route to move backwards @@ -144,48 +142,30 @@ export default { this.resetWarningsAndErrors(); // Lookup VIN - const vinLookupResponse = useMainStore().lookupVinByPlate({ - licensePlate: this.customerQuestions.licensePlate, - licenseState: this.licenseState, - }); + const vinLookupResponse = await useMainStore().lookupVinByPlate( + this.licensePlate, this.licenseState); - const registrationZipValidationResponse = useMainStore().validateZip( { zip: this.registrationZipCode }); - // Settle promises and get results const promiseResultMap = [ { resultKey: "vinLookupResponse", promise: vinLookupResponse, }, - { - resultKey: "registrationZipValidationResponse", - promise: registrationZipValidationResponse, - }, - { - // If serviceZipCode is not set, then sets the response to the registrationZipValidationResponse. Calls VALIDATE_ZIP if the serviceZipCode is set. - resultKey: "serviceZipValidationResponse", - promise: this.serviceZipCode - ? useMainStore().validateZip({zip: this.serviceZipCode}) - : registrationZipValidationResponse, - }, ]; const resultMap = await settleAllPromises(promiseResultMap); - + // No VIN found if (resultMap.vinLookupResponse.error) { - this.displayVinNotFoundAlert = true; - this.$refs.siteFooter.disableForwardButton(); - return this.$refs.siteFooter.removeLoader(); - } - // If no VIN was found, stop processing after displaying alert - if (!resultMap.vinLookupResponse) { - return; - } + this.displayVinNotFoundAlert = true; + this.$refs.siteFooter.disableForwardButton(); + return this.$refs.siteFooter.removeLoader(); + }; + // Vehicle found from VIN lookup const vehicleFromLookup = resultMap.vinLookupResponse.vehicle; - // Check if the CarId has changed. + // Check if the CarId has changed this.isCarIdDifferent = vehicleFromLookup.carId !== useMainStore().order.vehicle.carId; // Handle changing car @@ -198,7 +178,7 @@ export default { this.customAlertData.vehicleInfo = vehicleFromLookup; this.displayMatchedDifferentVehicleAlert = true; this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId( - vehicleFromLookup.carId + vehicleFromLookup.carId ); // Update button "Continue with..." @@ -212,11 +192,10 @@ export default { await useMainStore().saveRegistrationLicensePlateLookup( { isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle, - vehicleInfo: Object.assign(this.mainStore.order.vehicle), + vehicleInfo: Object.assign(vehicleFromLookup, {vin: vehicleFromLookup.vin }), registrationInfo: { licensePlate: this.licensePlate, - state: resultMap.registrationZipValidationResponse.state, - zipCode: this.registrationZipCode, + state: this.licenseState, }, }, false