From c5553e01d1ebb94a511bd534b5053f9f02a2e9b9 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 20 Dec 2024 11:44:14 +0530 Subject: [PATCH] Fixed: shipGroup information is not being displayed for all orders(#886) For orders other than completed status the shipGroup information is missing, as the shipment information is not available for those orders, so added a null check before processing the shipment information for orders(#886) --- src/store/modules/orderLookup/actions.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/store/modules/orderLookup/actions.ts b/src/store/modules/orderLookup/actions.ts index 58606f8c..5a440af2 100644 --- a/src/store/modules/orderLookup/actions.ts +++ b/src/store/modules/orderLookup/actions.ts @@ -106,7 +106,7 @@ const actions: ActionTree = { }) if(!hasError(resp)) { - resp.data.docs.map((doc: any) => { + resp.data.docs?.map((doc: any) => { systemProperties[doc.systemResourceId.toUpperCase()] = doc.systemPropertyValue }) } else { @@ -337,7 +337,7 @@ const actions: ActionTree = { const productIds: Array = [] const shipmentMethodIds: Array = [] - const orderRouteSegmentInfo = orderRouteSegment.status === "fulfilled" && orderRouteSegment.value.data.docs.length > 0 ? orderRouteSegment.value.data.docs.reduce((orderSegmentInfo: any, routeSegment: any) => { + const orderRouteSegmentInfo = orderRouteSegment.status === "fulfilled" && orderRouteSegment.value.data.docs?.length > 0 ? orderRouteSegment.value.data.docs.reduce((orderSegmentInfo: any, routeSegment: any) => { if(orderSegmentInfo[routeSegment.shipGroupSeqId]) orderSegmentInfo[routeSegment.shipGroupSeqId].push(routeSegment) else orderSegmentInfo[routeSegment.shipGroupSeqId] = [routeSegment] return orderSegmentInfo @@ -374,7 +374,7 @@ const actions: ActionTree = { const carrierPartyIds = [] as any; if(orderShipGroups.status === "fulfilled" && !hasError(orderShipGroups.value) && orderShipGroups.value.data.count > 0) { - shipGroups = orderShipGroups.value.data.docs.reduce((shipGroups: any, shipGroup: any) => { + shipGroups = orderShipGroups.value.data.docs?.reduce((shipGroups: any, shipGroup: any) => { productIds.push(shipGroup.productId) shipGroup.shipmentMethodTypeId && shipmentMethodIds.includes(shipGroup.shipmentMethodTypeId) ? '' : shipmentMethodIds.push(shipGroup.shipmentMethodTypeId) shipGroup.shipGroupSeqId && shipGroupSeqIds.includes(shipGroup.shipGroupSeqId) ? '' : shipGroupSeqIds.push(shipGroup.shipGroupSeqId)