fix for mismatched vehicle - navigates to correct page
This commit is contained in:
parent
853a7affe7
commit
8da1c0c7c8
1 changed files with 13 additions and 34 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue