diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index f6e0d2b3d..f29e3d21a 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -188,7 +188,7 @@ export default { this.resetWarningsAndErrors(); // Lookup VIN(s) with the provided address - const vinLookup = this.lookupVin( + const vinLookupPromise = this.lookupVin( this.customerQuestions.lastName, this.customerQuestions.addressQuestions.streetAddress, this.customerQuestions.addressQuestions.zipCode, @@ -196,10 +196,10 @@ export default { ); // Verify if the service zip code or registration zip code provided is serviceable - const zipValidation = this.serviceZipCode ? this.validateZip(this.serviceZipCode) : this.validateZip(this.customerQuestions.addressQuestions.zipCode); + const serviceZipValidationPromise = this.serviceZipCode ? this.validateZip(this.serviceZipCode) : this.validateZip(this.customerQuestions.addressQuestions.zipCode); - const vinLookupResponse = await vinLookup; - const zipValidationResponse = await zipValidation; + const vinLookupResponse = await vinLookupPromise; + const serviceZipValidationResponse = await serviceZipValidationPromise; if (!vinLookupResponse.data.isStatePermissible) { // State Restrictions forbid lookup by address @@ -209,7 +209,7 @@ export default { } // if the neither the registration zip code or service zip code are not serviceable - this.isZipServicable = zipValidationResponse.data.isServiceable; + this.isZipServicable = serviceZipValidationResponse.data.isServiceable; if (!this.isZipServicable) { this.displayNonServiceableZipAlert = true; this.showServiceZipField = true; @@ -253,7 +253,7 @@ export default { // update data if the zip or service zip is servicable this.updateVehicleInfo(carsFound[0].vin, carFound); - this.updateCustomerInfo(); + this.updateCustomerInfo(serviceZipValidationResponse.data.state); } else if (carsFound.length > 1) { if (!this.isZipServicable) { @@ -270,7 +270,7 @@ export default { } // update data if the zip or service zip is servicable - this.updateCustomerInfo(); + this.updateCustomerInfo(serviceZipValidationResponse.data.state); } this.navigateForward(carEntered, carsFound); @@ -346,7 +346,7 @@ export default { store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, vehicleInfo.imageVifNumber); store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, vehicleInfo.imageColor); }, - updateCustomerInfo() { + updateCustomerInfo(serviceState) { store.commit(storeMutations.UPDATE_REGISTRATION_ADDRESS, this.customerQuestions.addressQuestions.streetAddress); store.commit(storeMutations.UPDATE_REGISTRATION_CITY, this.customerQuestions.addressQuestions.city); store.commit(storeMutations.UPDATE_REGISTRATION_STATE, this.customerQuestions.addressQuestions.state); @@ -354,6 +354,7 @@ export default { store.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, this.customerQuestions.firstName); store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, this.customerQuestions.lastName); store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, this.serviceZipCode); + store.commit(storeMutations.UPDATE_SERVICE_LOCATION_STATE, serviceState); store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.customerQuestions.emailAddress); }, updateServiceLocationIfNecessary() {