From 19f775c46332cf18937861f8c2d23d633d87b5a4 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Tue, 4 Feb 2025 06:40:19 -0500 Subject: [PATCH] CASH-97 CASH-97 use a store action/mutation to persist phone number in vuex. --- src/constants/store-actions.js | 1 + src/constants/store-mutations.js | 1 + src/router/index.js | 4 ++++ src/store/index.js | 7 +++++++ 4 files changed, 13 insertions(+) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index aee8d705f..ec6b0db0c 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -76,6 +76,7 @@ const storeActions = { SAVE_SERVICE_LOCATION: "saveServiceLocation", SAVE_SCHEDULE: "saveSchedule", SAVE_EMAIL: "saveEmail", + SAVE_PHONE_NUMBER: "savePhoneNumber", SAVE_REGISTRATION_LICENSE_PLATE_LOOKUP: "saveRegistrationLicensePlateLookup", SAVE_VIN: "saveVin", SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup", diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 2f231bb59..1ebf39b8d 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -41,6 +41,7 @@ const storeMutations = { // CUSTOMER MUTATIONS UPDATE_CUSTOMER_EMAIL_ADDRESS: "updateCustomerEmailAddress", + UPDATE_CUSTOMER_PHONE_NUMBER: "updateCustomerPhoneNumber", UPDATE_CUSTOMER_DETAILS: "updateCustomerDetails", // ORDER MUTATIONS diff --git a/src/router/index.js b/src/router/index.js index 2230a652d..9595cf11c 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -898,6 +898,10 @@ function updateExternalParameterState() { storeMutations.UPDATE_EXTERNAL_PARAMETER_PHONE_NUMBER, externalParameterPhoneNumber ); + store.commit( + storeMutations.UPDATE_CUSTOMER_PHONE_NUMBER, + externalParameterPhoneNumber + ); } } diff --git a/src/store/index.js b/src/store/index.js index c93ddf90a..c591d493d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -343,6 +343,9 @@ export const mutations = { updateCustomerEmailAddress(state, customerEmailAddress) { state.order.customer.emailAddress = customerEmailAddress; }, + updateCustomerPhoneNumber(state, phoneNumber) { + state.order.customer.phoneNumber = phoneNumber; + }, updateVehicle(state, vehicleInfo) { state.order.vehicle.year = vehicleInfo.year; state.order.vehicle.make = vehicleInfo.make; @@ -3038,6 +3041,10 @@ export const actions = { context.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, email === "" ? null : email); }, + savePhoneNumber(context, phoneNumber) { + context.commit(storeMutations.UPDATE_CUSTOMER_PHONE_NUMBER, phoneNumber === "" ? null : phoneNumber); + }, + saveVin(context, { isSelectedGlassAvailableForVehicle, vehicleInfo }) { //Reset dependent state when changing if (vehicleInfo.vin !== context.state.order.vehicle.vin) {