From 50ac8482909864c731927b89710d193248e06ff7 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 2 Aug 2022 11:12:19 -0400 Subject: [PATCH] CSR-702 Fix going back from vehicle-parts when there were no part-questions --- src/layouts/vehicle-parts/vehicle-parts.vue | 2 +- src/mixins/vehicle-questions-mixin.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index 290910217..27a92ddf4 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -159,7 +159,7 @@ export default { Object.keys(store.getters.pageData(fmgPageValues.VEHICLE_PARTS)).length !== 0; }, backButtonAction() { - const hasPartQuestions = this.hasPartQuestions(this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS).partsOrQuestions); + const hasPartQuestions = this.hasPartQuestions(this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS)?.partsOrQuestions); const backNavigationScenario = hasPartQuestions ? this.navigationScenarios.CLICKED_BACK_WITH_PART_QUESTION_ANSWERS : this.navigationScenarios.CLICKED_BACK_WITHOUT_PART_QUESTION_ANSWERS; this.$router.navigate( diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 7a86066a8..4331529d4 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -2,10 +2,10 @@ export default { methods: { hasPartQuestions(partsOrQuestions) { - return partsOrQuestions.some(pq => pq.partQuestions?.length > 0); + return partsOrQuestions?.some(pq => pq.partQuestions?.length > 0); }, hasGlassLocationWithMultipleParts(partsOrQuestions) { - return partsOrQuestions.some(pq => pq.parts?.length > 1); + return partsOrQuestions?.some(pq => pq.parts?.length > 1); }, hasChildPartQuestions(partsOrQuestions) { return partsOrQuestions.some(pq => {