Added code to display invalid zip alert

This commit is contained in:
Leah Schumann 2023-02-17 09:35:10 -05:00
parent ba80ae58d2
commit 4562f7679e

View file

@ -36,7 +36,7 @@
ref="alertInvalidZip" ref="alertInvalidZip"
v-if="displayInvalidZipAlert" v-if="displayInvalidZipAlert"
class="my-4" class="my-4"
:cmsWidgetName="AlertInvalidZipWidget" cmsWidgetName="AlertInvalidZipWidget"
alertClass="alert-danger" alertClass="alert-danger"
v-bind:isDismissible="false" /> v-bind:isDismissible="false" />
</modal> </modal>
@ -57,6 +57,7 @@ export default {
data() { data() {
return { return {
internalModel: this.copyModel(this.modelValue), internalModel: this.copyModel(this.modelValue),
displayInvalidZipAlert: false,
}; };
}, },
props: { props: {
@ -162,11 +163,17 @@ export default {
async setMobileLocation() { async setMobileLocation() {
// TODO: Any lookups or actions to be taken before assigning the Mobile Location // TODO: Any lookups or actions to be taken before assigning the Mobile Location
const zipCodeData = await this.getZipCodeData(this.internalModel.addressQuestions.zipCode);
// Update the page level model if (!zipCodeData.isValid) {
this.$emit("update:modelValue", this.internalModel); this.displayInvalidZipAlert = true;
} else {
// Update the page level model
this.$emit("update:modelValue", this.internalModel);
this.closeModal();
}
this.closeModal();
}, },
}, },
watch: { watch: {