CASH-250 clear phone / email when user clears the field
This commit is contained in:
CarlNation 2025-02-12 12:50:23 -05:00
parent ea1ca82409
commit 7caadb8880

View file

@ -202,12 +202,19 @@ export default {
async forwardButtonAction() { async forwardButtonAction() {
const zipCodeData = await this.getZipCodeData(this.serviceZipCode); const zipCodeData = await this.getZipCodeData(this.serviceZipCode);
// 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)) { if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
const phone = this.emailOrSms.replace(/[()]/g, ""); const phone = this.emailOrSms.replace(/[()]/g, "");
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false); await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false);
} else { } else {
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false); await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false);
} }
}
await this.dispatchStoreAction( await this.dispatchStoreAction(
storeActions.SAVE_PAGE_DATA, storeActions.SAVE_PAGE_DATA,