Getting rid of mainStore data property

This commit is contained in:
Michaela Brydon 2024-03-01 18:01:23 -05:00
parent ec85a33693
commit 5ac9970d65

View file

@ -177,7 +177,14 @@ export default {
await useMainStore().getFinalDeductible();
pricingResults = await useMainStore().getPriceOrderItems(availableLineItems)
.catch((err) => {
useMainStore().setBailout(to, bailoutMessage.pricingResponseError(availableLineItems.map((li) => li.partNumber), { code: err.code, message: err.message, data: err.data }));
useMainStore()
.setBailout(
to,
bailoutMessage.pricingResponseError(
availableLineItems.map((li) => li.partNumber),
{ code: err.code, message: err.message, data: err.data }
)
);
hasBailedOut = true;
next(`/?issPage=${issPageValues.BAILOUT_PAGE}`);
});
@ -198,10 +205,6 @@ export default {
});
}
},
setup() {
const mainStore = useMainStore();
return { mainStore };
},
data() {
return {
availableLineItems: [],
@ -368,7 +371,7 @@ export default {
},
async navigateForward() {
if (this.unverified || this.verifiedDeductible) {
this.mainStore.saveSupportingItems(this.supportingItems);
useMainStore().saveSupportingItems(this.supportingItems);
this.$router.navigate(
navigationScenarios.CLICKED_FORWARD,
this.$route,
@ -378,7 +381,7 @@ export default {
} else if (this.verifiedITAC || this.verifiedNoComp) {
useMainStore().updateIsSafeliteProvider(this.selectedProvider === 'Safelite');
if (this.selectedProvider === 'Safelite') {
this.mainStore.saveSupportingItems(this.supportingItems);
useMainStore().saveSupportingItems(this.supportingItems);
this.$router.navigate(
navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE,
this.$route,
@ -386,7 +389,7 @@ export default {
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
);
} else {
this.mainStore.setBailout(this.$router.currentRoute, bailoutMessage.RequestCallback());
useMainStore().setBailout(this.$router.currentRoute, bailoutMessage.RequestCallback());
this.$router.navigate(
navigationScenarios.CLICKED_FORWARD_WITH_NON_SAFELITE_SHOP,
this.$route,
@ -395,7 +398,7 @@ export default {
);
}
} else {
this.mainStore.setBailout(this.$router.currentRoute, bailoutMessage.coverageStatementInvalidState());
useMainStore().setBailout(this.$router.currentRoute, bailoutMessage.coverageStatementInvalidState());
this.$router.navigate(
navigationScenarios.CLICKED_FORWARD_WITH_INVALID_STATE,
this.$route,
@ -406,23 +409,23 @@ export default {
},
getHeaderTextFromCms(cmsWidgetName) {
const header = this.getCmsContent(cmsWidgetName, 'HeaderText');
return this.processIfStatements(header, 'custom', this.getCustomValueFromString);
return processIfStatements(header, 'custom', this.getCustomValueFromString);
},
getSubheaderTextFromCms(cmsWidgetName) {
const subHeader = this.getCmsContent(cmsWidgetName, 'SubHeaderText');
return this.processIfStatements(subHeader, 'custom', this.getCustomValueFromString);
return processIfStatements(subHeader, 'custom', this.getCustomValueFromString);
},
getBodyTextFromCms(cmsWidgetName) {
const bodyText = this.getCmsContent(cmsWidgetName, 'BodyText');
return this.processIfStatements(bodyText, 'custom', this.getCustomValueFromString);
return processIfStatements(bodyText, 'custom', this.getCustomValueFromString);
},
getSecondaryTextFromCms(cmsWidgetName) {
const secondaryText = this.getCmsContent(cmsWidgetName, 'SecondaryText');
return this.processIfStatements(secondaryText, 'custom', this.getCustomValueFromString);
return processIfStatements(secondaryText, 'custom', this.getCustomValueFromString);
},
getExplantoryTextFromCms(cmsWidgetName) {
const explanatoryText = this.getCmsContent(cmsWidgetName, 'BodyText');
return this.processIfStatements(explanatoryText, 'custom', this.getCustomValueFromString);
return processIfStatements(explanatoryText, 'custom', this.getCustomValueFromString);
},
getCustomValueFromString(str) {
switch (str) {