From 7caadb88808ae69c50ae12fbb04179d1615c3af3 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Wed, 12 Feb 2025 12:50:23 -0500 Subject: [PATCH] CASH-250 CASH-250 clear phone / email when user clears the field --- src/layouts/service-zip/service-zip.vue | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/layouts/service-zip/service-zip.vue b/src/layouts/service-zip/service-zip.vue index 717880553..ae7609da8 100644 --- a/src/layouts/service-zip/service-zip.vue +++ b/src/layouts/service-zip/service-zip.vue @@ -202,11 +202,18 @@ export default { async forwardButtonAction() { const zipCodeData = await this.getZipCodeData(this.serviceZipCode); - if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) { - const phone = this.emailOrSms.replace(/[()]/g, ""); - await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false); - } else { - await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false); + // if no value due to field being optional, blank both phone and email address + if (!this.emailOrSms) { + await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false); + await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false); + } + else { + if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) { + const phone = this.emailOrSms.replace(/[()]/g, ""); + await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false); + } else { + await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false); + } } await this.dispatchStoreAction(