forked from tsai/budibase
committed by
GitHub
6 changed files with 36 additions and 45 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("An error has occurred") |
||||
|
: notificationStore.success("Automation triggered") |
||||
|
return res |
||||
} |
} |
||||
|
|||||
@ -1,14 +1,18 @@ |
|||||
|
import { notificationStore } from "../store/notification" |
||||
import API from "./api" |
import API from "./api" |
||||
|
|
||||
/** |
/** |
||||
* Executes a query against an external data connector. |
* Executes a query against an external data connector. |
||||
*/ |
*/ |
||||
export const executeQuery = async ({ queryId, parameters }) => { |
export const executeQuery = async ({ queryId, parameters }) => { |
||||
const response = await API.post({ |
const res = await API.post({ |
||||
url: `/api/queries/${queryId}`, |
url: `/api/queries/${queryId}`, |
||||
body: { |
body: { |
||||
parameters, |
parameters, |
||||
}, |
}, |
||||
}) |
}) |
||||
return response |
res.error |
||||
|
? notificationStore.danger("An error has occurred") |
||||
|
: notificationStore.success("Query successful") |
||||
|
return res |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue