1
0
Fork 0
mirror of synced 2024-07-04 14:01:27 +12:00

Remove unnecessary enrichment from button action calls

This commit is contained in:
Andrew Kingston 2021-02-05 11:51:07 +00:00
parent 1fb84ceeea
commit 6eec1632d9

View file

@ -1,5 +1,4 @@
import { get } from "svelte/store" import { get } from "svelte/store"
import { enrichDataBinding, enrichDataBindings } from "./enrichDataBinding"
import { routeStore, builderStore } from "../store" import { routeStore, builderStore } from "../store"
import { saveRow, deleteRow, executeQuery, triggerAutomation } from "../api" import { saveRow, deleteRow, executeQuery, triggerAutomation } from "../api"
import { ActionTypes } from "../constants" import { ActionTypes } from "../constants"
@ -10,7 +9,7 @@ const saveRowHandler = async (action, context) => {
let draft = context[providerId] let draft = context[providerId]
if (fields) { if (fields) {
for (let [key, entry] of Object.entries(fields)) { for (let [key, entry] of Object.entries(fields)) {
draft[key] = await enrichDataBinding(entry.value, context) draft[key] = entry.value
} }
} }
await saveRow(draft) await saveRow(draft)
@ -24,12 +23,12 @@ const deleteRowHandler = async action => {
} }
} }
const triggerAutomationHandler = async (action, context) => { const triggerAutomationHandler = async action => {
const { fields } = action.parameters const { fields } = action.parameters
if (fields) { if (fields) {
const params = {} const params = {}
for (let field in fields) { for (let field in fields) {
params[field] = await enrichDataBinding(fields[field].value, context) params[field] = fields[field].value
} }
await triggerAutomation(action.parameters.automationId, params) await triggerAutomation(action.parameters.automationId, params)
} }