From d2af84ac18bd30cf5aeb4d9652d1aa6c72206267 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Wed, 27 Mar 2024 18:55:53 +0530 Subject: [PATCH] Fixed: run not displayed after creation immediately(#135) Added check to wait for fetching updated information after new run creation Fixed productStoreId to be dynamic when creating new run --- src/store/modules/orderRouting/actions.ts | 4 ++-- src/views/BrokeringRuns.vue | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/store/modules/orderRouting/actions.ts b/src/store/modules/orderRouting/actions.ts index 9372d16..2561b66 100644 --- a/src/store/modules/orderRouting/actions.ts +++ b/src/store/modules/orderRouting/actions.ts @@ -60,7 +60,7 @@ const actions: ActionTree = { async createRoutingGroup({ dispatch }, groupName) { const payload = { groupName, - productStoreId: "STORE", + productStoreId: store.state.user.currentEComStore.productStoreId, createdDate: DateTime.now().toMillis() } try { @@ -68,7 +68,7 @@ const actions: ActionTree = { if(!hasError(resp)) { showToast(translate("Brokering run created")) - dispatch("fetchOrderRoutingGroups") + await dispatch("fetchOrderRoutingGroups") } else { throw resp.data } diff --git a/src/views/BrokeringRuns.vue b/src/views/BrokeringRuns.vue index b6e3a3d..5a76064 100644 --- a/src/views/BrokeringRuns.vue +++ b/src/views/BrokeringRuns.vue @@ -142,14 +142,15 @@ async function addNewRun() { }] }) - newRunAlert.onDidDismiss().then((result: any) => { + newRunAlert.onDidDismiss().then(async (result: any) => { // considering that if we have role, then its negative action and thus not need to create run if(result.role) { return; } if(result.data?.values?.runName.trim()) { - store.dispatch("orderRouting/createRoutingGroup", result.data.values.runName.trim()) + await store.dispatch("orderRouting/createRoutingGroup", result.data.values.runName.trim()) + brokeringGroups.value = JSON.parse(JSON.stringify(groups.value)) } })