diff --git a/.DS_Store b/.DS_Store index 0dfd56565a..363dbb1c4c 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/packages/builder/src/builderStore/loadComponentLibraries.js b/packages/builder/src/builderStore/loadComponentLibraries.js index ada00134f4..f7ceec303f 100644 --- a/packages/builder/src/builderStore/loadComponentLibraries.js +++ b/packages/builder/src/builderStore/loadComponentLibraries.js @@ -1,3 +1,5 @@ +import { get } from "builderStore/api"; + /** * Fetches the definitions for component library components. This includes * their props and other metadata from components.json. @@ -6,7 +8,7 @@ export const fetchComponentLibDefinitions = async appId => { const LIB_DEFINITION_URL = `/${appId}/components/definitions` try { - const libDefinitionResponse = await fetch(LIB_DEFINITION_URL) + const libDefinitionResponse = await get(LIB_DEFINITION_URL) return await libDefinitionResponse.json() } catch (err) { console.error(`Error fetching component definitions for ${appId}`, err) diff --git a/packages/builder/src/components/userInterface/SettingsView.svelte b/packages/builder/src/components/userInterface/SettingsView.svelte index 36b2ab9c75..99e704d1d9 100644 --- a/packages/builder/src/components/userInterface/SettingsView.svelte +++ b/packages/builder/src/components/userInterface/SettingsView.svelte @@ -16,7 +16,7 @@ } -{#if panelDefinition.length > 0} +{#if panelDefinition && panelDefinition.length > 0} {#each panelDefinition as definition} {#if propExistsOnComponentDef(definition.key)} { if (!username) ctx.throw(400, "Username Required.") if (!password) ctx.throw(400, "Password Required") - // TODO: Don't use this. It can't be relied on - const referer = ctx.request.headers.referer.split("/") - const appId = referer[3] - // find the instance that the user is associated with const db = new CouchDB(ClientDb.name(env.CLIENT_ID)) - const app = await db.get(appId) + const app = await db.get(ctx.params.appId) const instanceId = app.userInstanceMap[username] if (!instanceId) diff --git a/packages/server/src/api/routes/auth.js b/packages/server/src/api/routes/auth.js index b4b68e8929..fa95a3a5e6 100644 --- a/packages/server/src/api/routes/auth.js +++ b/packages/server/src/api/routes/auth.js @@ -3,6 +3,6 @@ const controller = require("../controllers/auth") const router = Router() -router.post("/api/authenticate", controller.authenticate) +router.post("/:appId/api/authenticate", controller.authenticate) module.exports = router