Made the calls to vin lookup and zip verification asynchronous

This commit is contained in:
Leah Schumann 2022-05-09 16:21:07 -04:00
parent c74ea197ac
commit 93605adec0

View file

@ -181,14 +181,19 @@ export default {
this.resetWarningsAndErrors();
// Lookup VIN(s) with the provided address
const vinLookup = await this.lookupVin(
const vinLookup = this.lookupVin(
this.customerQuestions.lastName,
this.customerQuestions.addressQuestions.streetAddress,
this.customerQuestions.addressQuestions.zipCode,
this.customerQuestions.addressQuestions.state
);
if (!vinLookup.data.isStatePermissible) {
const zipValidation = this.serviceZipCode ? this.validateZip(this.serviceZipCode) : this.validateZip(this.customerQuestions.addressQuestions.zipCode);
const vinLookupResponse = await vinLookup;
const zipValidationResponse = await zipValidation;
if (!vinLookupResponse.data.isStatePermissible) {
// State Restrictions forbid lookup by address
this.displayVinLookupByHomeAddressNotAllowedAlert = true;
this.$refs.funnelFooter.removeLoader();
@ -196,8 +201,7 @@ export default {
}
// Validate if the original or service zip provided is serviceable
const zipValidation = this.serviceZipCode ? await this.validateZip(this.serviceZipCode) : await this.validateZip(this.customerQuestions.addressQuestions.zipCode);
this.isZipServicable = zipValidation.data.isServiceable;
this.isZipServicable = zipValidationResponse.data.isServiceable;
if (!this.isZipServicable) {
this.displayNonServiceableZipAlert = true;
this.showServiceZipField = true;
@ -205,7 +209,7 @@ export default {
}
const carEntered = store.getters.vehicle;
const carsFound = vinLookup.data.vinVehicles;
const carsFound = vinLookupResponse.data.vinVehicles;
if (carsFound.length == 0) {
// No VINs found
@ -256,7 +260,7 @@ export default {
this.displayMatchedDifferentVehicleAlert = false;
this.displayVinLookupByHomeAddressNotAllowedAlert = false;
},
async navigateForward(carEntered, carsFound) {
navigateForward(carEntered, carsFound) {
if (carsFound.length == 1) {
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
this.$router.navigateAfterSave(