Adding new API endpoint which provides all definitions in one.
This commit is contained in:
parent
76cfb5062d
commit
b1a8837c0c
|
@ -7,17 +7,15 @@ const workflowActions = store => ({
|
||||||
fetch: async () => {
|
fetch: async () => {
|
||||||
const responses = await Promise.all([
|
const responses = await Promise.all([
|
||||||
api.get(`/api/workflows`),
|
api.get(`/api/workflows`),
|
||||||
api.get(`/api/workflows/trigger/list`),
|
api.get(`/api/workflows/definition/list`),
|
||||||
api.get(`/api/workflows/action/list`),
|
|
||||||
api.get(`/api/workflows/logic/list`),
|
|
||||||
])
|
])
|
||||||
const jsonResponses = await Promise.all(responses.map(x => x.json()))
|
const jsonResponses = await Promise.all(responses.map(x => x.json()))
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state.workflows = jsonResponses[0]
|
state.workflows = jsonResponses[0]
|
||||||
state.blockDefinitions = {
|
state.blockDefinitions = {
|
||||||
TRIGGER: jsonResponses[1],
|
TRIGGER: jsonResponses[1].trigger,
|
||||||
ACTION: jsonResponses[2],
|
ACTION: jsonResponses[1].action,
|
||||||
LOGIC: jsonResponses[3],
|
LOGIC: jsonResponses[1].logic,
|
||||||
}
|
}
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
|
|
|
@ -78,6 +78,14 @@ exports.getLogicList = async function(ctx) {
|
||||||
ctx.body = blockDefinitions.LOGIC
|
ctx.body = blockDefinitions.LOGIC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.getDefinitionList = async function(ctx) {
|
||||||
|
ctx.body = {
|
||||||
|
logic: blockDefinitions.LOGIC,
|
||||||
|
trigger: blockDefinitions.TRIGGER,
|
||||||
|
action: blockDefinitions.ACTION,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* *
|
* *
|
||||||
* API FUNCTIONS *
|
* API FUNCTIONS *
|
||||||
|
|
|
@ -52,6 +52,11 @@ router
|
||||||
authorized(BUILDER),
|
authorized(BUILDER),
|
||||||
controller.getLogicList
|
controller.getLogicList
|
||||||
)
|
)
|
||||||
|
.get(
|
||||||
|
"/api/workflows/definitions/list",
|
||||||
|
authorized(BUILDER),
|
||||||
|
controller.getDefinitionList
|
||||||
|
)
|
||||||
.get("/api/workflows", authorized(BUILDER), controller.fetch)
|
.get("/api/workflows", authorized(BUILDER), controller.fetch)
|
||||||
.get("/api/workflows/:id", authorized(BUILDER), controller.find)
|
.get("/api/workflows/:id", authorized(BUILDER), controller.find)
|
||||||
.put(
|
.put(
|
||||||
|
|
Loading…
Reference in New Issue