1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 23:37:55 +00:00
bramw_baserow/web-frontend/modules/builder/services/workflowAction.js

44 lines
1.1 KiB
JavaScript

export default (client) => {
return {
create(pageId, workflowActionType, eventType, configuration = null) {
const payload = {
type: workflowActionType,
event: eventType,
...configuration,
}
return client.post(`builder/page/${pageId}/workflow_actions/`, payload)
},
fetchAll(pageId) {
return client.get(`builder/page/${pageId}/workflow_actions/`)
},
delete(workflowActionId) {
return client.delete(`builder/workflow_action/${workflowActionId}/`)
},
update(workflowActionId, values) {
return client.patch(
`builder/workflow_action/${workflowActionId}/`,
values
)
},
order(pageId, order, elementId = null) {
const payload = { workflow_action_ids: order }
if (elementId) {
payload.element_id = elementId
}
return client.post(
`builder/page/${pageId}/workflow_actions/order/`,
payload
)
},
dispatch(workflowActionId, data) {
return client.post(
`builder/workflow_action/${workflowActionId}/dispatch/`,
data
)
},
}
}