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