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