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