fix issue with automation not triggering when no fields existed

This commit is contained in:
Peter Clement 2024-01-26 09:21:13 +00:00
parent 0efe0bb7ac
commit 58fedd10f5
1 changed files with 17 additions and 19 deletions

View File

@ -160,29 +160,27 @@ const deleteRowHandler = async action => {
const triggerAutomationHandler = async action => { const triggerAutomationHandler = async action => {
const { fields, notificationOverride, timeout } = action.parameters const { fields, notificationOverride, timeout } = action.parameters
if (fields) { try {
try { const result = await API.triggerAutomation({
const result = await API.triggerAutomation({ automationId: action.parameters.automationId,
automationId: action.parameters.automationId, fields,
fields, timeout,
timeout, })
})
// Value will exist if automation is synchronous, so return it.
if (result.value) {
if (!notificationOverride) {
notificationStore.actions.success("Automation ran successfully")
}
return { result }
}
// Value will exist if automation is synchronous, so return it.
if (result.value) {
if (!notificationOverride) { if (!notificationOverride) {
notificationStore.actions.success("Automation triggered") notificationStore.actions.success("Automation ran successfully")
} }
} catch (error) { return { result }
// Abort next actions
return false
} }
if (!notificationOverride) {
notificationStore.actions.success("Automation triggered")
}
} catch (error) {
// Abort next actions
return false
} }
} }
const navigationHandler = action => { const navigationHandler = action => {