From 68a63de959399132018cfed55b2bae393ab676ca Mon Sep 17 00:00:00 2001 From: Jason Wheeler Date: Thu, 19 Jan 2023 13:53:04 -0500 Subject: [PATCH 1/2] Fixed issue with address-lookup triggering validation when autopopulating empty values on load and the user getting a page full of errors on first load --- src/layouts/address-lookup/address-lookup.vue | 17 +++-------------- src/store/index.js | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index fc692200..1fb6868d 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -96,16 +96,7 @@ export default { }, data() { return { - customerQuestions: { - addressQuestions: { - streetAddress: "", - city: "", - state: "", - zipCode: "", - }, - firstName: "", - lastName: "", - }, + customerQuestions: useMainStore().customerData, displayVinNotFoundAlert: false, displayMatchedDifferentVehicleAlert: false, displayVinLookupByHomeAddressNotAllowedAlert: false, @@ -119,9 +110,7 @@ export default { arePagePrerequisitesValid() { return this.mainStore.order.vehicle.carId !== null; }, - loadDefaultsFromStore() { - this.customerQuestions = this.mainStore.customerDataAddressLookup; - }, + backButtonAction() { // route to move backwards this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); @@ -277,7 +266,7 @@ export default { }, mounted() { this.attachCustomEvents(); - this.loadDefaultsFromStore(); + }, computed: { AlertMatchedDifferentVehicleHeader() { diff --git a/src/store/index.js b/src/store/index.js index e228bee1..403951d6 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -128,7 +128,7 @@ export const useMainStore = defineStore({ pageData: (state) => (page) => { return state.applicationUser.pageData[page]; }, - customerDataAddressLookup: (state) => { + customerData: (state) => { if (state.order.vehicle.registration.address) { const registration = state.order.vehicle.registration; From 6bae6a3fc71c073b3a7635f69df7ffd2854f8889 Mon Sep 17 00:00:00 2001 From: Jason Wheeler Date: Thu, 19 Jan 2023 14:12:17 -0500 Subject: [PATCH 2/2] forgot to update test --- src/store/store.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index c8721b6d..e282f849 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -181,7 +181,7 @@ describe("Store", () => { }; //Act - const actual = store.customerDataAddressLookup; + const actual = store.customerData; //Assert expect(actual).toEqual(expected); @@ -213,7 +213,7 @@ describe("Store", () => { }; //Act - const actual = store.customerDataAddressLookup; + const actual = store.customerData; //Assert expect(actual).toEqual(expected);