Corrected some store code, added data retrieval from store for when the user has returned to the page.

This commit is contained in:
Leah Schumann 2022-05-02 11:09:06 -04:00
parent c533c8b819
commit a4f7b862eb
2 changed files with 37 additions and 12 deletions

View file

@ -112,16 +112,16 @@ export default {
return { return {
customerQuestions: { customerQuestions: {
addressQuestions: { addressQuestions: {
streetAddress: "", streetAddress: this.getRegistrationAddressFromStore(),
city: "", city: this.getRegistrationCityFromStore(),
state: "", state: this.getRegistrationStateFromStore(),
zip: "", zip: this.getRegistrationZipFromStore(),
}, },
firstName: "", firstName: this.getRegistrationFirstNameFromStore(),
lastName: "", lastName: this.getRegistrationLastNameFromStore(),
emailAddress: "", emailAddress: this.getEmailFromStore(),
}, },
serviceZip: "", serviceZip: this.getServiceZipFromStore(),
displayNonServiceableZipAlert: false, displayNonServiceableZipAlert: false,
displayVinNotFoundAlert: false, displayVinNotFoundAlert: false,
displayMatchedDifferentVehicleAlert: false, displayMatchedDifferentVehicleAlert: false,
@ -145,6 +145,30 @@ export default {
this.$route 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() { async forwardButtonAction() {
this.resetWarningsAndErrors(); this.resetWarningsAndErrors();
@ -184,6 +208,7 @@ export default {
if (carEntered.carId == carFound.carId || carFound.carId == this.previousCarIdFound) { if (carEntered.carId == carFound.carId || carFound.carId == this.previousCarIdFound) {
// update data // update data
this.updateVehicleInfo(carFound.vin, carFound); this.updateVehicleInfo(carFound.vin, carFound);
this.updateCustomerInfo();
// navigate forward // navigate forward
this.navigateForward(carEntered, carsFound); this.navigateForward(carEntered, carsFound);

View file

@ -147,14 +147,14 @@ export const mutations = {
updateServiceLocationZip(state, serviceLocationZip){ updateServiceLocationZip(state, serviceLocationZip){
state.order.serviceLocation.zip = serviceLocationZip; state.order.serviceLocation.zip = serviceLocationZip;
}, },
updateRegistrationCity(state, serviceCity){ updateRegistrationCity(state, registrationCity){
state.order.serviceLocation.city = serviceCity; state.order.vehicle.registration.city = registrationCity;
}, },
updateRegistrationFirstName(state, firstName){ updateRegistrationFirstName(state, firstName){
state.order.serviceLocation.firstName = firstName; state.order.vehicle.registration.firstName = firstName;
}, },
updateRegistrationLastName(state, lastName){ updateRegistrationLastName(state, lastName){
state.order.serviceLocation.lastName = lastName; state.order.vehicle.registration.lastName = lastName;
}, },
updateCustomerEmailAddress(state, customerEmailAddress){ updateCustomerEmailAddress(state, customerEmailAddress){
state.order.customer.emailAddress = customerEmailAddress; state.order.customer.emailAddress = customerEmailAddress;