Fixed logic that was pulling back available wipers incorrectly

This commit is contained in:
Leah Schumann 2023-12-28 09:52:23 -05:00
parent dc91998d6a
commit 5604ffd1a8

View file

@ -124,18 +124,21 @@ export default {
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const lineItemsFromStore = deepClone(store.getters.order.lineItems); const lineItemsFromStore = deepClone(store.getters.order.lineItems);
const frontWipersOnOrder = const frontWipersOnOrder =
lineItemsFromStore.vaps.filter( lineItemsFromStore.vaps.filter(
(wiper) => wiper.partType == partTypeStrings.FRONT_WIPER (wiper) => wiper.partType == partTypeStrings.FRONT_WIPER
) ?? []; ) ?? [];
const rearWipersOnOrder = const rearWipersOnOrder =
lineItemsFromStore.vaps.filter( lineItemsFromStore.vaps.filter(
(wiper) => wiper.partType == partTypeStrings.REAR_WIPER (wiper) => wiper.partType == partTypeStrings.REAR_WIPER
) ?? []; ) ?? [];
const orderHasFrontWipers = frontWipersOnOrder.length > 0; const orderHasFrontWipers = frontWipersOnOrder.length > 0;
const orderHasRearWipers = rearWipersOnOrder.length > 0; const orderHasRearWipers = rearWipersOnOrder.length > 0;
const wipersPromise = orderHasFrontWipers const wipersPromise = (!orderHasFrontWipers || !orderHasRearWipers)
? baseMixin.methods.dispatchStoreActionWithLogging( ? baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.GET_WIPERS, storeActions.GET_WIPERS,
{ {
@ -168,7 +171,7 @@ export default {
]; ];
const resultMap = await settleAllPromises(promiseResultMap); const resultMap = await settleAllPromises(promiseResultMap);
console.log(resultMap.wipers)
const glassParts = lineItemsFromStore.glassParts ?? []; const glassParts = lineItemsFromStore.glassParts ?? [];
const supportingItems = lineItemsFromStore.supportingItems ?? []; const supportingItems = lineItemsFromStore.supportingItems ?? [];
const vaps = lineItemsFromStore.vaps ?? []; const vaps = lineItemsFromStore.vaps ?? [];