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 {
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);

View file

@ -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;