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:
parent
24a2b0719f
commit
63245465a8
2 changed files with 19 additions and 27 deletions
|
|
@ -73,7 +73,7 @@ import {
|
||||||
getRouterLinkRouteFromCopy,
|
getRouterLinkRouteFromCopy,
|
||||||
getRouterLinkDisplayTextFromCopy,
|
getRouterLinkDisplayTextFromCopy,
|
||||||
} from "@/helpers/cms-content-helper";
|
} 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 { errorMessages } from "@/constants/error-messages";
|
||||||
import { required } from "@/helpers/validation-rules";
|
import { required } from "@/helpers/validation-rules";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
|
@ -146,24 +146,24 @@ export default {
|
||||||
customSelectableDatesCallback: getAvailableDates,
|
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(
|
const premiumFeePromise = baseMixin.methods.dispatchStoreAction(
|
||||||
storeActions.GET_MOBILE_PREMIUM_FEE
|
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(
|
const alertReasonsPromise = locationAlerts.methods.loadInitialData(
|
||||||
store.getters.order.serviceLocation.zipCodeCtu
|
store.getters.order.serviceLocation.zipCodeCtu
|
||||||
);
|
);
|
||||||
|
|
@ -182,12 +182,8 @@ export default {
|
||||||
promise: datePickerInitialDataPromise,
|
promise: datePickerInitialDataPromise,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
resultKey: "premiumFee",
|
resultKey: "premiumFeeWithPrice",
|
||||||
promise: premiumFeePromise,
|
promise: premiumFeeWithPricePromise,
|
||||||
},
|
|
||||||
{
|
|
||||||
resultKey: "pricingResults",
|
|
||||||
promise: pricingPromise,
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -199,9 +195,7 @@ export default {
|
||||||
vm.$refs.datePicker.initializeComponent(resultMap.datePickerInitialData);
|
vm.$refs.datePicker.initializeComponent(resultMap.datePickerInitialData);
|
||||||
vm.$refs.locationAlerts.initializeComponent(resultMap.alertReasons);
|
vm.$refs.locationAlerts.initializeComponent(resultMap.alertReasons);
|
||||||
vm.selectableDatesData = resultMap.datePickerInitialData.initialShopTimeSlotsResponse;
|
vm.selectableDatesData = resultMap.datePickerInitialData.initialShopTimeSlotsResponse;
|
||||||
if (resultMap.premiumFee) {
|
vm.mobilePremiumAppointmentFee = resultMap.premiumFeeWithPrice ? resultMap.premiumFeeWithPrice[0] : null;
|
||||||
vm.mobilePremiumAppointmentFee = resultMap.pricingResults[0];
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
||||||
|
|
@ -1187,7 +1187,6 @@ export const actions = {
|
||||||
method: endpoints.GetShopTimeSlots.method,
|
method: endpoints.GetShopTimeSlots.method,
|
||||||
endpoint: endpoints.GetShopTimeSlots.url,
|
endpoint: endpoints.GetShopTimeSlots.url,
|
||||||
payload: payload,
|
payload: payload,
|
||||||
logApiCall: false,
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1239,7 +1238,6 @@ export const actions = {
|
||||||
method: endpoints.GetMobileTimeSlots.method,
|
method: endpoints.GetMobileTimeSlots.method,
|
||||||
endpoint: endpoints.GetMobileTimeSlots.url,
|
endpoint: endpoints.GetMobileTimeSlots.url,
|
||||||
payload: payload,
|
payload: payload,
|
||||||
logApiCall: false,
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue