From a4f7b862ebbad8771d6463ace13deb0b531f5dd6 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 2 May 2022 11:09:06 -0400 Subject: [PATCH] Corrected some store code, added data retrieval from store for when the user has returned to the page. --- src/layouts/address-lookup/address-lookup.vue | 41 +++++++++++++++---- src/store/index.js | 8 ++-- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 3dbd07457..b503e11dc 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -112,16 +112,16 @@ export default { return { customerQuestions: { addressQuestions: { - streetAddress: "", - city: "", - state: "", - zip: "", + streetAddress: this.getRegistrationAddressFromStore(), + city: this.getRegistrationCityFromStore(), + state: this.getRegistrationStateFromStore(), + zip: this.getRegistrationZipFromStore(), }, - firstName: "", - lastName: "", - emailAddress: "", + firstName: this.getRegistrationFirstNameFromStore(), + lastName: this.getRegistrationLastNameFromStore(), + emailAddress: this.getEmailFromStore(), }, - serviceZip: "", + serviceZip: this.getServiceZipFromStore(), displayNonServiceableZipAlert: false, displayVinNotFoundAlert: false, displayMatchedDifferentVehicleAlert: false, @@ -145,6 +145,30 @@ export default { this.$route ); }, + getRegistrationAddressFromStore() { + return store.getters.vehicle.registration.address; + }, + getRegistrationCityFromStore() { + return store.getters.vehicle.registration.city; + }, + getRegistrationStateFromStore() { + return store.getters.vehicle.registration.state; + }, + getRegistrationZipFromStore() { + return store.getters.vehicle.registration.zipCode; + }, + getRegistrationFirstNameFromStore() { + return store.getters.vehicle.registration.firstName; + }, + getRegistrationLastNameFromStore() { + return store.getters.vehicle.registration.lastName; + }, + getEmailFromStore() { + return store.getters.order.customer.emailAddress; + }, + getServiceZipFromStore() { + return store.getters.order.serviceLocation.zip; + }, async forwardButtonAction() { this.resetWarningsAndErrors(); @@ -184,6 +208,7 @@ export default { if (carEntered.carId == carFound.carId || carFound.carId == this.previousCarIdFound) { // update data this.updateVehicleInfo(carFound.vin, carFound); + this.updateCustomerInfo(); // navigate forward this.navigateForward(carEntered, carsFound); diff --git a/src/store/index.js b/src/store/index.js index 18c218c3f..03797976a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -147,14 +147,14 @@ export const mutations = { updateServiceLocationZip(state, serviceLocationZip){ state.order.serviceLocation.zip = serviceLocationZip; }, - updateRegistrationCity(state, serviceCity){ - state.order.serviceLocation.city = serviceCity; + updateRegistrationCity(state, registrationCity){ + state.order.vehicle.registration.city = registrationCity; }, updateRegistrationFirstName(state, firstName){ - state.order.serviceLocation.firstName = firstName; + state.order.vehicle.registration.firstName = firstName; }, updateRegistrationLastName(state, lastName){ - state.order.serviceLocation.lastName = lastName; + state.order.vehicle.registration.lastName = lastName; }, updateCustomerEmailAddress(state, customerEmailAddress){ state.order.customer.emailAddress = customerEmailAddress;