SSR-1410 Fix zipCodeCtu missing causing errors on coverage-statement
This commit is contained in:
parent
a484af7982
commit
1fcd36b2a9
2 changed files with 22 additions and 9 deletions
|
|
@ -119,7 +119,6 @@ import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin.js';
|
|||
import globalRules from '@/constants/global-rules.js';
|
||||
import baseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
||||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import bailoutMessage from '@/constants/bailoutMessage';
|
||||
import widgetFields from '@/constants/cms-widget-fields.js';
|
||||
import { formatAmountInDollars } from '@/helpers/text-helper.js';
|
||||
|
|
@ -145,9 +144,11 @@ export default {
|
|||
},
|
||||
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
const store = useMainStore();
|
||||
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to?.query?.issPage);
|
||||
const supportingItemsPromise = await useMainStore().getSupportingItems();
|
||||
const supportingItemsPromise = store.getSupportingItems();
|
||||
|
||||
// Settle promises and get results
|
||||
const promiseResultMap = [
|
||||
|
|
@ -161,15 +162,26 @@ export default {
|
|||
}
|
||||
];
|
||||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
||||
const { vehicle, isPolicyLookupSuccessful, isITAC, isDeductible } = useMainStore();
|
||||
if (isPolicyLookupSuccessful && vehicle.policyVehicleId >= 0) {
|
||||
if (isITAC || isDeductible) {
|
||||
await useMainStore().getFinalDeductible();
|
||||
}
|
||||
const { vehicle, isPolicyLookupSuccessful, isITAC, isDeductible, isUnverified, serviceLocation } = store;
|
||||
if (!isUnverified
|
||||
&& (isITAC || isDeductible)
|
||||
&& isPolicyLookupSuccessful
|
||||
&& vehicle.policyVehicleId >= 0) {
|
||||
promiseResultMap.push({
|
||||
resultKey: 'getFinalDeductible',
|
||||
promise: store.getFinalDeductible()
|
||||
});
|
||||
}
|
||||
|
||||
if (!serviceLocation.zipCodeCtu) {
|
||||
promiseResultMap.push({
|
||||
resultKey: 'validateZip',
|
||||
promise: store.validateZip({ zip: store.order.policy.policyZipCode })
|
||||
});
|
||||
}
|
||||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
||||
next(async (vm) => {
|
||||
showIssLoadingModal(true);
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
|
|
|
|||
|
|
@ -263,6 +263,7 @@ export const useMainStore = defineStore({
|
|||
lineItems: (state) => state.order.lineItems,
|
||||
payment: (state) => state.order.payment,
|
||||
policy: (state) => state.order.policy,
|
||||
serviceLocation: (state) => state.order.serviceLocation,
|
||||
hasExactlyOneChip: () => state.order.damage.numberOfChips === 1,
|
||||
isPolicyVehicle: () => state.order.vehicle.policyVehicleId != null,
|
||||
hasWindshieldReplacement: (s) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue