Skip to content

Commit

Permalink
Merge pull request #219 from sanskar345/fulfillment-pwa/#218
Browse files Browse the repository at this point in the history
Implemented: a check in findOrders actions in progress and completed that if no orders are found then do not fetch additional information
  • Loading branch information
ravilodhi authored Aug 1, 2023
2 parents 029f77b + 6c4c180 commit 4f883d1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ const actions: ActionTree<OrderState, RootState> = {
commit(types.ORDER_INPROGRESS_UPDATED, {orders, total})

// fetching the additional information like shipmentRoute, carrierParty information
dispatch('fetchInProgressOrdersAdditionalInformation')
// If no orders then no need to fetch any additional information
if(orders.length){
dispatch('fetchInProgressOrdersAdditionalInformation');
}

emitter.emit('dismissLoader');
return resp;
Expand Down Expand Up @@ -423,10 +426,13 @@ const actions: ActionTree<OrderState, RootState> = {

commit(types.ORDER_COMPLETED_QUERY_UPDATED, { ...completedOrderQuery })
commit(types.ORDER_COMPLETED_UPDATED, {list: orders, total})

// fetching the additional information like shipmentRoute, carrierParty information
// TODO make it async and use skelatal pattern
await dispatch('fetchCompletedOrdersAdditionalInformation')
// If no orders then no need to fetch any additional information
if(orders.length){
await dispatch('fetchCompletedOrdersAdditionalInformation');
}

emitter.emit('dismissLoader');
return resp;
Expand Down

0 comments on commit 4f883d1

Please sign in to comment.