budibase/packages/client/src/api/automations.js

16 lines
466 B
JavaScript
Raw Normal View History

import { notificationStore } from "../store/notification"
import API from "./api"
/**
* Executes an automation. Must have "App Action" trigger.
*/
export const triggerAutomation = async (automationId, fields) => {
const res = await API.post({
url: `/api/automations/${automationId}/trigger`,
body: { fields },
})
res.error
2021-01-25 13:36:35 +01:00
? notificationStore.danger("An error has occurred")
2021-01-25 12:57:04 +01:00
: notificationStore.success("Automation triggered")
return res
}