refactor logic for policy lookup

This commit is contained in:
Katie Kroell 2023-05-16 11:20:02 -04:00
parent b8a72d7f41
commit 070b9dc7d5

View file

@ -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() {