forked from tsai/budibase
3 changed files with 18 additions and 8 deletions
@ -1,10 +1,15 @@ |
|||||
|
import { notificationStore } from "../store/notification" |
||||
import API from "./api" |
import API from "./api" |
||||
/** |
/** |
||||
* Executes an automation. Must have "App Action" trigger. |
* Executes an automation. Must have "App Action" trigger. |
||||
*/ |
*/ |
||||
export const triggerAutomation = async (automationId, fields) => { |
export const triggerAutomation = async (automationId, fields) => { |
||||
return await API.post({ |
const res = await API.post({ |
||||
url: `/api/automations/${automationId}/trigger`, |
url: `/api/automations/${automationId}/trigger`, |
||||
body: { fields }, |
body: { fields }, |
||||
}) |
}) |
||||
|
res.error |
||||
|
? notificationStore.danger("En error has occured") |
||||
|
: notificationStore.success("Automation triggered.") |
||||
|
return res |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue