From 0f12f196199b8159c98d951ee494cf9ab3db53d3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 12 Nov 2020 09:31:04 +0000 Subject: [PATCH] Fix client errors --- packages/client/src/createApp.js | 2 +- packages/client/src/index.js | 2 +- packages/client/src/state/bbComponentApi.js | 9 --------- packages/client/src/state/eventHandlers.js | 9 ++++----- packages/client/src/state/runEventHandler.js | 0 5 files changed, 6 insertions(+), 16 deletions(-) delete mode 100644 packages/client/src/state/runEventHandler.js diff --git a/packages/client/src/createApp.js b/packages/client/src/createApp.js index df64b477a8..649cff1f4f 100644 --- a/packages/client/src/createApp.js +++ b/packages/client/src/createApp.js @@ -2,7 +2,7 @@ import { attachChildren } from "./render/attachChildren" import { createTreeNode } from "./render/prepareRenderComponent" import { screenRouter } from "./render/screenRouter" import { createStateManager } from "./state/stateManager" -import { getAppId } from "./render/getAppId" +import { getAppId } from "../../component-sdk/src/utils" export const createApp = ({ componentLibraries, diff --git a/packages/client/src/index.js b/packages/client/src/index.js index d553d4fabe..0e803a0f76 100644 --- a/packages/client/src/index.js +++ b/packages/client/src/index.js @@ -1,6 +1,6 @@ import { createApp } from "./createApp" import { builtins, builtinLibName } from "./render/builtinComponents" -import { getAppId } from "./render/getAppId" +import { getAppId } from "../../component-sdk/src/utils" /** * create a web application from static budibase definition files. diff --git a/packages/client/src/state/bbComponentApi.js b/packages/client/src/state/bbComponentApi.js index 1c2819f0ad..e3299fe986 100644 --- a/packages/client/src/state/bbComponentApi.js +++ b/packages/client/src/state/bbComponentApi.js @@ -1,20 +1,12 @@ import setBindableComponentProp from "./setBindableComponentProp" import { attachChildren } from "../render/attachChildren" import store from "../state/store" -import { baseApiCall } from "../api/index" export const bbFactory = ({ componentLibraries, onScreenSlotRendered, runEventActions, }) => { - const api = { - post: (url, body) => baseApiCall("POST", url, body), - get: (url, body) => baseApiCall("GET", url, body), - patch: (url, body) => baseApiCall("PATCH", url, body), - delete: (url, body) => baseApiCall("DELETE", url, body), - } - return (treeNode, setupState) => { const attachParams = { componentLibraries, @@ -33,7 +25,6 @@ export const bbFactory = ({ store.getState(treeNode.contextStoreKey) )), setBinding: setBindableComponentProp(treeNode), - api, parent, store: store.getStore(treeNode.contextStoreKey), // these parameters are populated by screenRouter diff --git a/packages/client/src/state/eventHandlers.js b/packages/client/src/state/eventHandlers.js index 7461913929..a8f73a8a09 100644 --- a/packages/client/src/state/eventHandlers.js +++ b/packages/client/src/state/eventHandlers.js @@ -1,15 +1,14 @@ -import api from "../api" import renderTemplateString from "./renderTemplateString" +import { updateRow, saveRow, deleteRow } from "../../../component-sdk" export const EVENT_TYPE_MEMBER_NAME = "##eventHandlerType" export const eventHandlers = routeTo => { const handlers = { "Navigate To": param => routeTo(param && param.url), - "Update Row": api.updateRow, - "Save Row": api.saveRow, - "Delete Row": api.deleteRow, - "Trigger Workflow": api.triggerWorkflow, + "Update Row": updateRow, + "Save Row": saveRow, + "Delete Row": deleteRow, } // when an event is called, this is what gets run diff --git a/packages/client/src/state/runEventHandler.js b/packages/client/src/state/runEventHandler.js deleted file mode 100644 index e69de29bb2..0000000000