Remove unnecessary enrichment from button action calls

This commit is contained in:
Andrew Kingston 2021-02-05 11:51:07 +00:00
parent 5846e2ef7c
commit 185f4ec468
1 changed files with 3 additions and 4 deletions

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)
} }