Make invalid zip alert computed

This commit is contained in:
Scott Kiener 2025-07-17 13:32:17 -04:00
parent 8889e59352
commit 5b8d92fa74

View file

@ -108,7 +108,6 @@ export default {
numberOfShopsToDisplay: 0,
localShopProviderData: this.shopProviderDataFromParent,
localSelectedProviderNumber: null,
displayInvalidZipAlert: false, // part of big refactor of asyn calls
displayNoShopsAlert: false, // part of big refactor of asyn calls
zipCodeData: null,
};
@ -137,6 +136,9 @@ export default {
showMoreShopsLinkText() {
return this.getCmsContent("ShowMoreShopsLinkWidget", "Text");
},
displayInvalidZipAlert() {
return this.zipCodeData && !this.zipCodeData.isValid;
},
modal() {
return this.$refs.shopQuestionModal;
},
@ -251,9 +253,7 @@ export default {
this.zipCodeData = await this.getZipCodeData(this.localZipCode, "service-location");
// Add zipCode to zipCodeData as it does not come back from endpoint
this.zipCodeData.zipCode = this.localZipCode;
if (!this.zipCodeData.isValid) {
this.displayInvalidZipAlert = true; // Think we can remove once done refactoring save method
} else {
if (this.zipCodeData.isValid) {
if (this.isVehicleHeavyTruck) {
// check the location endpoint to verify this zip can service a heavy truck
const closestShops = await getClosestApplicableShops(
@ -293,7 +293,6 @@ export default {
this.displayNoShopsAlert = this.answers.length === 0;
},
resetAlerts() {
this.displayInvalidZipAlert = false;
this.displayNoServiceAlert = false;
this.displayNoShopsAlert = false;
},