CSR-1137 | Remove pre-emptive pricing call

Added them in sequence to run together with the async group
Also removed the logApiCall:false
This commit is contained in:
Scott Kiener 2023-05-31 11:44:57 -04:00
parent 24a2b0719f
commit 63245465a8
2 changed files with 19 additions and 27 deletions

View file

@ -73,7 +73,7 @@ import {
getRouterLinkRouteFromCopy,
getRouterLinkDisplayTextFromCopy,
} from "@/helpers/cms-content-helper";
import { AppointmentTypeStrings, PREMIUM_FEE_PART_TYPE } from "./constants/schedule-constants";
import { AppointmentTypeStrings } from "./constants/schedule-constants";
import { errorMessages } from "@/constants/error-messages";
import { required } from "@/helpers/validation-rules";
import store from "@/store";
@ -146,24 +146,24 @@ export default {
customSelectableDatesCallback: getAvailableDates,
});
// Price EARLY BIRD pre-emptively to allow for asynchronous call to pricing
const pricingPromise = baseMixin.methods.dispatchStoreAction(
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
{
availableLineItems: [
{
partNumber: PREMIUM_FEE_PART_TYPE,
partType: PREMIUM_FEE_PART_TYPE,
description: null,
},
],
},
false
);
const premiumFeePromise = baseMixin.methods.dispatchStoreAction(
storeActions.GET_MOBILE_PREMIUM_FEE
);
const premiumFeeWithPricePromise = premiumFeePromise.then(result => {
if (result.data) {
return baseMixin.methods.dispatchStoreAction(
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
{
availableLineItems: [result.data],
},
false
);
} else {
return result.data;
}
});
const alertReasonsPromise = locationAlerts.methods.loadInitialData(
store.getters.order.serviceLocation.zipCodeCtu
);
@ -182,12 +182,8 @@ export default {
promise: datePickerInitialDataPromise,
},
{
resultKey: "premiumFee",
promise: premiumFeePromise,
},
{
resultKey: "pricingResults",
promise: pricingPromise,
resultKey: "premiumFeeWithPrice",
promise: premiumFeeWithPricePromise,
},
];
@ -199,9 +195,7 @@ export default {
vm.$refs.datePicker.initializeComponent(resultMap.datePickerInitialData);
vm.$refs.locationAlerts.initializeComponent(resultMap.alertReasons);
vm.selectableDatesData = resultMap.datePickerInitialData.initialShopTimeSlotsResponse;
if (resultMap.premiumFee) {
vm.mobilePremiumAppointmentFee = resultMap.pricingResults[0];
}
vm.mobilePremiumAppointmentFee = resultMap.premiumFeeWithPrice ? resultMap.premiumFeeWithPrice[0] : null;
});
},
computed: {

View file

@ -1187,7 +1187,6 @@ export const actions = {
method: endpoints.GetShopTimeSlots.method,
endpoint: endpoints.GetShopTimeSlots.url,
payload: payload,
logApiCall: false,
});
},
@ -1239,7 +1238,6 @@ export const actions = {
method: endpoints.GetMobileTimeSlots.method,
endpoint: endpoints.GetMobileTimeSlots.url,
payload: payload,
logApiCall: false,
});
},