This commit is contained in:
Leah Schumann 2023-03-15 08:18:20 -04:00
parent 977785a069
commit f8dc7f12f8

View file

@ -85,11 +85,19 @@ export default {
async beforeRouteEnter(to, from, next) {
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const getZipCodeData = baseMixin.methods.getZipCodeData(serviceZipCode);
const lineItems = store.getters.order.lineItems;
const serviceabilityDetailsPromise = getServiceabilityDetails({
serviceZipCode: serviceZipCode,
lineItems: lineItems,
});
const serviceZipCode = store.getters.order.serviceLocation.zipCode;
const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace";
const parentAccountNumber = store.getters.payment.parentAccountNumber;
const billToAccountNumber = 1;
const getZipCodeData = baseMixin.methods.getZipCodeData(serviceZipCode);
const mobileFeePartPromise = getPricedMobileFeePart(
serviceZipCode,
@ -108,6 +116,10 @@ export default {
resultKey: "mobileFeePart",
promise: mobileFeePartPromise,
},
{
resultKey: "serviceabilityDetails",
promise: serviceabilityDetailsPromise,
},
{
resultKey: "zipCodeData",
promise: getZipCodeData,
@ -119,7 +131,7 @@ export default {
// Call the "next" function to complete the transition to this page.
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.setData(resultMap.mobileFeePart);
vm.setData(resultMap.zipCodeData, resultMap.serviceabilityDetails, resultMap.mobileFeePart);
});
},
computed: {
@ -175,13 +187,20 @@ export default {
);
},
setData(zipCodeData, mobileFeePart) {
if (mobileFeePart) {
this.mobileFeePart = mobileFeePart;
}
if (zipCodeData) {
this.zipContainsMilitaryBase = zipCodeData.containsMilitaryBase;
}
if (serviceabilityDetails) {
this.isGlassServiceableInShop = serviceabilityDetails.isGlassServiceableInShop;
this.isRecalibrationServiceableInShop = serviceabilityDetails.isRecalibrationServiceableInShop;
this.isGlassServiceableMobile = serviceabilityDetails.isGlassServiceableMobile;
this.isRecalibrationServiceableMobile = serviceabilityDetails.isRecalibrationServiceableMobile;
}
if (mobileFeePart) {
this.mobileFeePart = mobileFeePart;
}
},
getServiceAddressFromStore() {
return store.getters.order.serviceLocation.address;