Merge pull request #1665 from Safelite/feature/CSR-1851-fix-missing-add-wipers-button

Fixed logic that was pulling back available wipers incorrectly
This commit is contained in:
Leah Schumann 2023-12-28 10:11:34 -05:00 committed by GitHub
commit 90d1d0cdd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -129,18 +129,22 @@ 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,
{ {