Update URLs for fetching component libraries to be under api route

This commit is contained in:
Andrew Kingston 2021-04-01 11:49:57 +01:00
parent 60a045b4c3
commit 55208b1358
1 changed files with 2 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import { get } from "builderStore/api"
* @param {string} appId - ID of the currently running app * @param {string} appId - ID of the currently running app
*/ */
export const fetchComponentLibDefinitions = async appId => { export const fetchComponentLibDefinitions = async appId => {
const LIB_DEFINITION_URL = `/${appId}/components/definitions` const LIB_DEFINITION_URL = `/api/${appId}/components/definitions`
try { try {
const libDefinitionResponse = await get(LIB_DEFINITION_URL) const libDefinitionResponse = await get(LIB_DEFINITION_URL)
return await libDefinitionResponse.json() return await libDefinitionResponse.json()
@ -22,7 +22,7 @@ export const fetchComponentLibDefinitions = async appId => {
export const fetchComponentLibModules = async application => { export const fetchComponentLibModules = async application => {
const allLibraries = {} const allLibraries = {}
for (let libraryName of application.componentLibraries) { for (let libraryName of application.componentLibraries) {
const LIBRARY_URL = `/${application._id}/componentlibrary?library=${libraryName}` const LIBRARY_URL = `/api/${application._id}/componentlibrary?library=${libraryName}`
allLibraries[libraryName] = await import(LIBRARY_URL) allLibraries[libraryName] = await import(LIBRARY_URL)
} }
return allLibraries return allLibraries