refactor store access
This commit is contained in:
parent
3376fbb9d5
commit
3961534838
1 changed files with 18 additions and 16 deletions
|
|
@ -114,8 +114,6 @@ import { errorMessages } from "@/constants/error-messages";
|
|||
// DEFINE VALIDATION RULES
|
||||
defineRule("selection-required", required(errorMessages.OPTION_REQUIRED));
|
||||
|
||||
const store = useMainStore();
|
||||
|
||||
export default {
|
||||
name: 'coverage-statement',
|
||||
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
||||
|
|
@ -123,7 +121,7 @@ export default {
|
|||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||
|
||||
const supportingItemsPromise = await store.getSupportingItems();
|
||||
const supportingItemsPromise = await useMainStore().getSupportingItems();
|
||||
|
||||
// Settle promises and get results
|
||||
const promiseResultMap = [
|
||||
|
|
@ -147,15 +145,15 @@ export default {
|
|||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
||||
const clonedGlassParts = store.order.lineItems.glassParts
|
||||
? JSON.parse(JSON.stringify(store.order.lineItems.glassParts))
|
||||
const clonedGlassParts = useMainStore().order.lineItems.glassParts
|
||||
? JSON.parse(JSON.stringify(useMainStore().order.lineItems.glassParts))
|
||||
: [];
|
||||
const availableLineItems = [
|
||||
...resultMap.supportingItems,
|
||||
...clonedGlassParts,
|
||||
];
|
||||
|
||||
const pricingResults = await store.getPriceOrderItems(availableLineItems);
|
||||
const pricingResults = await useMainStore().getPriceOrderItems(availableLineItems);
|
||||
|
||||
// Call the "next" function to complete the transition to this page.
|
||||
next((vm) => {
|
||||
|
|
@ -181,7 +179,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
isVerified: store.order.payment.insuranceCoverage.isVerified,
|
||||
isVerified: useMainStore().order.payment.insuranceCoverage.isVerified,
|
||||
supportingItems: [],
|
||||
pricedGlassParts: [],
|
||||
availableLineItems: [],
|
||||
|
|
@ -189,6 +187,10 @@ export default {
|
|||
deductibleText: "Your deductible is:",
|
||||
}
|
||||
},
|
||||
setup() {
|
||||
const mainStore = useMainStore();
|
||||
return { mainStore };
|
||||
},
|
||||
computed: {
|
||||
verifiedITACAlertHeader() {
|
||||
return this.getCmsContent(
|
||||
|
|
@ -240,12 +242,12 @@ export default {
|
|||
},
|
||||
vehicleDeductible() {
|
||||
if (this.coverageVerified) {
|
||||
if (store.order.damage.isRepair) {
|
||||
const repairDeductible = store.order.policy.deductible.repair
|
||||
if (this.mainStore.order.damage.isRepair) {
|
||||
const repairDeductible = this.mainStore.order.policy.deductible.repair
|
||||
return repairDeductible;
|
||||
}
|
||||
else {
|
||||
const replaceDeductible = store.order.policy.deductible.replace;
|
||||
const replaceDeductible = this.mainStore.order.policy.deductible.replace;
|
||||
return replaceDeductible;
|
||||
}
|
||||
}
|
||||
|
|
@ -271,7 +273,7 @@ export default {
|
|||
},
|
||||
verifiedNoComp() {
|
||||
if (this.coverageVerified) {
|
||||
return store.order.policy.noCoverage;
|
||||
return this.mainStore.order.policy.noCoverage;
|
||||
}
|
||||
},
|
||||
verifiedITAC() {
|
||||
|
|
@ -289,8 +291,8 @@ export default {
|
|||
}
|
||||
},
|
||||
ADASReplace() {
|
||||
if (!store.order.damage.isRepair) {
|
||||
let parts = store.order.lineItems.glassParts;
|
||||
if (!this.mainStore.order.damage.isRepair) {
|
||||
let parts = this.mainStore.order.lineItems.glassParts;
|
||||
|
||||
if (parts != null && parts.filter(part => part.requiresRecalibration).length > 0) {
|
||||
return true;
|
||||
|
|
@ -298,12 +300,12 @@ export default {
|
|||
}
|
||||
},
|
||||
nonADASReplace() {
|
||||
if (!store.order.damage.isRepair) {
|
||||
if (!this.mainStore.order.damage.isRepair) {
|
||||
return !this.ADASReplace;
|
||||
}
|
||||
},
|
||||
nonADASRepair() {
|
||||
if (store.order.damage.isRepair) {
|
||||
if (this.mainStore.order.damage.isRepair) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
|
@ -359,7 +361,7 @@ export default {
|
|||
this.$route
|
||||
)
|
||||
}
|
||||
else if (store.issConfig.enableTPAFlow){
|
||||
else if (this.mainStore.issConfig.enableTPAFlow){
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_THIRD_PARTY,
|
||||
this.$route
|
||||
|
|
|
|||
Loading…
Reference in a new issue