Skip to content

Commit

Permalink
Improved: updating order state in case of create picklist (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Aug 28, 2024
1 parent 81fd388 commit b21edcb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,10 @@ const actions: ActionTree<OrderState , RootState> ={
emitter.emit("dismissLoader");
},

updateOpenOrder ({ commit }, payload) {
commit(types.ORDER_OPEN_UPDATED, {orders: payload.orders , total: payload.total})
},

// clearning the orders state when logout, or user store is changed
clearOrders ({ commit }) {
commit(types.ORDER_OPEN_UPDATED, {orders: {} , total: 0})
Expand Down
6 changes: 5 additions & 1 deletion src/views/Orders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,11 @@ export default defineComponent({
if(!hasError(resp)) {
// generating picklist after creating a new picklist
await OrderService.printPicklist(resp.data.picklistId)
this.getPickupOrders();
const orders = JSON.parse(JSON.stringify(this.orders))
const updatedOrder = orders.find((currentOrder: any) => currentOrder.orderId === order.orderId);
updatedOrder["isPicked"] = "Y"
updatedOrder["picklistId"] = resp.data.picklistId
this.store.dispatch("order/updateOpenOrder", { orders, total: orders.length })
} else {
throw resp.data;
}
Expand Down

0 comments on commit b21edcb

Please sign in to comment.