From 070b9dc7d53c66ec864af9022262cb0cd727b6e7 Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Tue, 16 May 2023 11:20:02 -0400 Subject: [PATCH] refactor logic for policy lookup --- src/layouts/welcome-page/welcome-page.vue | 42 ++++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 63b959cd..c36a9a0b 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -283,31 +283,33 @@ export default { }, navigateForward(policy) { - // if policy lookup is unsuccessful, navigate to policy-holder-details page - if (!policy) { + if (policy) { + if (this.vehiclesFound) { + // if policy lookup is successful and vehicles are found, navigate to policy-vehicles page + this.$router.navigate( + this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES, + this.$route, + {}, + {}, + this.vehiclesFound + ); + } + else { + // if policy lookup is successful, but no vehicles are associated with the policy + // navigate to vehicle-selection page (manual entry) + this.$router.navigate( + this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES, + this.$route + ); + } + } + else { + // if policy lookup is unsuccessful, navigate to policy-holder-details page this.$router.navigate( this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED, this.$route ); } - // if policy lookup is successful, but no vehicles are associated with the policy - // navigate to vehicle-selection page (manual entry) - else if (policy && !this.vehiclesFound) { - this.$router.navigate( - this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES, - this.$route - ); - } - // if policy lookup is successful and vehicles are found, navigate to policy-vehicles page - else if (policy && this.vehiclesFound) { - this.$router.navigate( - this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES, - this.$route, - {}, - {}, - this.vehiclesFound - ); - } }, getWelcomePageModelFromStore() {