Wrapped saveMobileLocation (mobile-location-modal-questions) into a condition to ensure that the zip has actually changed.
This commit is contained in:
parent
91d723b3eb
commit
6bb83f4d65
1 changed files with 28 additions and 23 deletions
|
|
@ -236,35 +236,40 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async setMobileLocation() {
|
async setMobileLocation() {
|
||||||
// Validate the Zip Code
|
if (
|
||||||
const zipCodeData = await this.getZipCodeData(
|
this.internalModel.addressQuestions.zipCode !==
|
||||||
this.internalModel.addressQuestions.zipCode
|
this.modelValue.addressQuestions.zipCode
|
||||||
);
|
) {
|
||||||
|
// Validate the Zip Code
|
||||||
|
const zipCodeData = await this.getZipCodeData(
|
||||||
|
this.internalModel.addressQuestions.zipCode
|
||||||
|
);
|
||||||
|
|
||||||
if (!zipCodeData.isValid) {
|
if (!zipCodeData.isValid) {
|
||||||
this.displayInvalidZipAlert = true;
|
this.displayInvalidZipAlert = true;
|
||||||
this.resetModalButtonStyle();
|
this.resetModalButtonStyle();
|
||||||
} else {
|
} else {
|
||||||
// retrieve mobile fee part
|
// retrieve mobile fee part
|
||||||
const serviceZipCode = this.internalModel.addressQuestions.zipCode;
|
const serviceZipCode = this.internalModel.addressQuestions.zipCode;
|
||||||
const mobileFeePart = await getPricedMobileFeePart(serviceZipCode);
|
const mobileFeePart = await getPricedMobileFeePart(serviceZipCode);
|
||||||
|
|
||||||
// retrieve serviceability details
|
// retrieve serviceability details
|
||||||
const serviceabilityDetails = await getServiceabilityDetails(serviceZipCode);
|
const serviceabilityDetails = await getServiceabilityDetails(serviceZipCode);
|
||||||
|
|
||||||
// update content related to service zip code
|
// update content related to service zip code
|
||||||
this.$emit("updated-mobile-fee-part", mobileFeePart);
|
this.$emit("updated-mobile-fee-part", mobileFeePart);
|
||||||
this.$emit("updated-serviceability", serviceabilityDetails.data);
|
this.$emit("updated-serviceability", serviceabilityDetails.data);
|
||||||
this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
|
this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
|
||||||
|
|
||||||
// Update the page level model
|
// Update the page level model
|
||||||
this.$emit("update:modelValue", this.internalModel);
|
this.$emit("update:modelValue", this.internalModel);
|
||||||
|
|
||||||
if (this.onZipUpdateCallback) {
|
if (this.onZipUpdateCallback) {
|
||||||
await this.onZipUpdateCallback(serviceZipCode);
|
await this.onZipUpdateCallback(serviceZipCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.closeModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.closeModal();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue