Skip to content

Commit

Permalink
Implemented: support to create new run(#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymaheshwari1 committed Jan 16, 2024
1 parent 65c7591 commit b92eb9f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/services/RoutingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@ const fetchRoutingGroups = async (payload: any): Promise<any> => {
return api({
url: "groups",
method: "GET",
data: payload
query: payload
});
}

const createRoutingGroup = async (payload: any): Promise<any> => {
return api({
url: "groups",
method: "POST",
data: payload
})
}

export const OrderRoutingService = {
createRoutingGroup,
fetchRoutingGroups
}
20 changes: 19 additions & 1 deletion src/store/modules/orderRouting/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ActionTree } from "vuex"
import RootState from "@/store/RootState"
import OrderRoutingState from "./OrderRoutingState"
import { OrderRoutingService } from "@/services/RoutingService"
import { hasError, sortSequence } from "@/utils"
import { hasError, showToast, sortSequence } from "@/utils"
import * as types from './mutation-types'

const actions: ActionTree<OrderRoutingState, RootState> = {
Expand All @@ -28,6 +28,24 @@ const actions: ActionTree<OrderRoutingState, RootState> = {
}

commit(types.ORDER_ROUTING_GROUPS_UPDATED, routingGroups)
},

async createBrokeringGroup({ dispatch }, groupName) {
const payload = {
groupName,
productStoreId: "STORE"
}
try {
const resp = await OrderRoutingService.createRoutingGroup(payload)

if(!hasError(resp)) {
showToast('Brokering run created')
dispatch("fetchOrderRoutingGroups")
}
} catch(err) {
showToast("Failed to create brokering run")
console.log('err', err)

Check warning on line 47 in src/store/modules/orderRouting/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

Unexpected console statement

Check warning on line 47 in src/store/modules/orderRouting/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

Unexpected console statement
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/views/BrokeringRuns.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ async function addNewRun() {
}]
})
newRunAlert.onDidDismiss().then((result: any) => {
if(result.data?.values?.runName) {
store.dispatch('orderRouting/createBrokeringGroup', result.data.values.runName)
}
})
return newRunAlert.present();
}
Expand Down

0 comments on commit b92eb9f

Please sign in to comment.