CSR-658 skip style page when only 1 style
This commit is contained in:
parent
de7c80aae1
commit
ae6c242f2d
1 changed files with 22 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="page-container-grouped-styles" v-show="showStylePage">
|
||||
<funnelHeader cmsWidgetName="FunnelHeaderWidget" />
|
||||
<div class="select-car">
|
||||
<div class="select-car-form rounded text-center">
|
||||
|
|
@ -30,14 +30,17 @@ import { settleAllPromises } from "@/helpers/layout-helper";
|
|||
import { storeActions } from "@/constants/store-actions";
|
||||
import store from "@/store";
|
||||
import { storeMutations } from "@/constants/store-mutations";
|
||||
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||
|
||||
export default {
|
||||
name: "vehicle-style",
|
||||
data() {
|
||||
return {
|
||||
selectedStyle: null,
|
||||
showStylePage: false,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {},
|
||||
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
|
|
@ -61,11 +64,24 @@ export default {
|
|||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
||||
// Call the "next" function to complete the transition to this page.
|
||||
next((vm) => {
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
vm.$refs.styleQuestion.initializeComponent(
|
||||
resultMap.styleQuestionInitialData
|
||||
);
|
||||
next((vm) => {
|
||||
//skip this style page if only 1 vehicle style returned and they have yet to visit vehicle damage
|
||||
var visitedVehicleDamage = JSON.stringify(store.getters.applicationUser.pageData).indexOf(fmgPageValues.VEHICLE_DAMAGE) < 0 ? false : true;
|
||||
|
||||
if (resultMap.styleQuestionInitialData.lenghth > 1 || visitedVehicleDamage) {
|
||||
vm.showStylePage = true;
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
vm.$refs.styleQuestion.initializeComponent(
|
||||
resultMap.styleQuestionInitialData
|
||||
);
|
||||
}
|
||||
else{
|
||||
store.commit(storeMutations.UPDATE_STYLE, resultMap.styleQuestionInitialData[0]);
|
||||
vm.setVehicle().then(() => {
|
||||
vm.$router.navigateAfterSave(vm.navigationScenarios.SELECTED_STYLE,vm.$route);
|
||||
return;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue