From 32d1ca641b95a171036f7201a9a9a84af615042a Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Wed, 3 Jun 2020 22:12:09 +0100 Subject: [PATCH] bugfix: data components hitting correct url again --- packages/client/src/state/bbComponentApi.js | 2 +- packages/server/src/utilities/builder/buildPage.js | 2 +- packages/standard-components/src/Login.svelte | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/client/src/state/bbComponentApi.js b/packages/client/src/state/bbComponentApi.js index be918d3048..7366a90f5c 100644 --- a/packages/client/src/state/bbComponentApi.js +++ b/packages/client/src/state/bbComponentApi.js @@ -23,7 +23,7 @@ export const bbFactory = ({ } const apiCall = method => (url, body) => - fetch(relativeUrl(url), { + fetch(url, { method: method, headers: { "Content-Type": "application/json", diff --git a/packages/server/src/utilities/builder/buildPage.js b/packages/server/src/utilities/builder/buildPage.js index f1b5d6d724..3d44cb8072 100644 --- a/packages/server/src/utilities/builder/buildPage.js +++ b/packages/server/src/utilities/builder/buildPage.js @@ -45,7 +45,7 @@ const copyClientLib = async (appPath, pageName) => { const buildIndexHtml = async (config, appId, pageName, appPath, pkg) => { const appPublicPath = publicPath(appPath, pageName) - const appRootPath = appId + const appRootPath = rootPath(config, appId) const stylesheetUrl = s => s.startsWith("http") ? s : `/${rootPath(config, appId)}/${s}` diff --git a/packages/standard-components/src/Login.svelte b/packages/standard-components/src/Login.svelte index 58a2860be8..34168d01f4 100644 --- a/packages/standard-components/src/Login.svelte +++ b/packages/standard-components/src/Login.svelte @@ -25,9 +25,16 @@ const login = async () => { loading = true - const response = await _bb.api.post("/api/authenticate", { - username, - password, + const response = await fetch(_bb.relativeUrl("/api/authenticate"), { + body: JSON.stringify({ + username, + password, + }), + headers: { + "Content-Type": "application/json", + "x-user-agent": "Budibase Builder", + }, + method: "POST", }) if (response.status === 200) {