diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index b774da22..129168c7 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -556,7 +556,7 @@ const actions: ActionTree = { const orderQueryPayload = prepareOrderQuery(params) - let resp, total, shipGroups; + let resp, total, shipGroups = []; const facilityTypeIds: Array = []; try { @@ -574,6 +574,11 @@ const actions: ActionTree = { logger.error('Failed to fetch ship group information for order', err) } + // return if shipGroups are not found for order + if(!shipGroups.length) { + return; + } + shipGroups = shipGroups.map((shipGroup: any) => { const shipItem = shipGroup.doclist.docs[0] @@ -612,7 +617,7 @@ const actions: ActionTree = { const orderQueryPayload = prepareOrderQuery(params) - let resp, total, shipGroups: any; + let resp, total, shipGroups: any = []; try { resp = await OrderService.findOrderShipGroup(orderQueryPayload);