Quote
This commit is contained in:
parent
6161e8de12
commit
9a3318b3fd
3 changed files with 28 additions and 9 deletions
|
|
@ -36,6 +36,10 @@ jest.mock("@/mixins/base-mixin", () => ({
|
||||||
if (action === mockPriceOrderStoreAction) return items;
|
if (action === mockPriceOrderStoreAction) return items;
|
||||||
else return mockStoreActionResults[action];
|
else return mockStoreActionResults[action];
|
||||||
},
|
},
|
||||||
|
dispatchStoreActionWithLogging(action, items, pageName, encode) {
|
||||||
|
if (action === mockPriceOrderStoreAction) return items;
|
||||||
|
else return mockStoreActionResults[action];
|
||||||
|
},
|
||||||
getTierOnePackagePrice() {
|
getTierOnePackagePrice() {
|
||||||
return mockTierOnePrice;
|
return mockTierOnePrice;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,20 @@ 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 wipersPromise = baseMixin.methods.dispatchStoreAction(storeActions.GET_WIPERS);
|
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
const rainDefensePromise = baseMixin.methods.dispatchStoreAction(
|
storeActions.GET_WIPERS,
|
||||||
storeActions.GET_RAIN_DEFENSE
|
null,
|
||||||
|
"quote"
|
||||||
);
|
);
|
||||||
const supportingItemsPromise = baseMixin.methods.dispatchStoreAction(
|
const rainDefensePromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_SUPPORTING_ITEMS
|
storeActions.GET_RAIN_DEFENSE,
|
||||||
|
null,
|
||||||
|
"quote"
|
||||||
|
);
|
||||||
|
const supportingItemsPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
|
storeActions.GET_SUPPORTING_ITEMS,
|
||||||
|
null,
|
||||||
|
"quote"
|
||||||
);
|
);
|
||||||
|
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
|
|
@ -124,11 +132,12 @@ export default {
|
||||||
...clonedGlassParts,
|
...clonedGlassParts,
|
||||||
];
|
];
|
||||||
|
|
||||||
const pricingResults = await baseMixin.methods.dispatchStoreAction(
|
const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
||||||
{
|
{
|
||||||
availableLineItems: availableLineItems,
|
availableLineItems: availableLineItems,
|
||||||
},
|
},
|
||||||
|
"quote",
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1210,13 +1210,15 @@ export const actions = {
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
|
|
||||||
getWipers(context) {
|
getWipers(context, { pageNameToLog }) {
|
||||||
const carId = context.getters.vehicle.carId;
|
const carId = context.getters.vehicle.carId;
|
||||||
const serviceZipCode = context.getters.order.serviceLocation.zipCode;
|
const serviceZipCode = context.getters.order.serviceLocation.zipCode;
|
||||||
return globalMethods
|
return globalMethods
|
||||||
.callHttpClient({
|
.callHttpClient({
|
||||||
method: endpoints.GetWipers.method,
|
method: endpoints.GetWipers.method,
|
||||||
endpoint: `${endpoints.GetWipers.url}/${carId}/${serviceZipCode}`,
|
endpoint: `${endpoints.GetWipers.url}/${carId}/${serviceZipCode}`,
|
||||||
|
logApiCall: true,
|
||||||
|
pageNameToLog: pageNameToLog,
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
// The wiper service sometimes returns 500s on legitimate carId/zipCode combination - return empty array instead of breaking flow
|
// The wiper service sometimes returns 500s on legitimate carId/zipCode combination - return empty array instead of breaking flow
|
||||||
|
|
@ -1224,10 +1226,12 @@ export const actions = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getRainDefense(context) {
|
getRainDefense(context, { pageNameToLog }) {
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetRainDefense.method,
|
method: endpoints.GetRainDefense.method,
|
||||||
endpoint: endpoints.GetRainDefense.url,
|
endpoint: endpoints.GetRainDefense.url,
|
||||||
|
logApiCall: true,
|
||||||
|
pageNameToLog: pageNameToLog,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1959,7 +1963,7 @@ export const actions = {
|
||||||
// Price order actions
|
// Price order actions
|
||||||
async priceOrderItemsAndSaveServerData(
|
async priceOrderItemsAndSaveServerData(
|
||||||
context,
|
context,
|
||||||
{ availableLineItems, serviceZipCode, serviceZipCodeCtu }
|
{ payload: { availableLineItems, serviceZipCode, serviceZipCodeCtu }, pageNameToLog }
|
||||||
) {
|
) {
|
||||||
const zipCodeToUse = serviceZipCode
|
const zipCodeToUse = serviceZipCode
|
||||||
? serviceZipCode
|
? serviceZipCode
|
||||||
|
|
@ -1999,6 +2003,8 @@ export const actions = {
|
||||||
const response = await globalMethods.callHttpClient({
|
const response = await globalMethods.callHttpClient({
|
||||||
method: endpoints.PriceOrderItems.method,
|
method: endpoints.PriceOrderItems.method,
|
||||||
endpoint: `${endpoints.PriceOrderItems.url}?${queryString}`,
|
endpoint: `${endpoints.PriceOrderItems.url}?${queryString}`,
|
||||||
|
logApiCall: true,
|
||||||
|
pageNameToLog: pageNameToLog,
|
||||||
});
|
});
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_LINE_ITEMS_SERVER_DATA, response.data.serverData);
|
context.commit(storeMutations.UPDATE_LINE_ITEMS_SERVER_DATA, response.data.serverData);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue