1
0
Fork 0
mirror of synced 2024-06-30 12:00:31 +12:00
budibase/packages/builder/src/builderStore/loadComponentLibraries.js

17 lines
585 B
JavaScript
Raw Normal View History

2020-06-04 07:44:35 +12:00
import { get } from "builderStore/api"
2020-06-04 07:35:30 +12:00
/**
* Fetches the definitions for component library components. This includes
* their props and other metadata from components.json.
* @param {string} appId - ID of the currently running app
*/
2021-05-04 22:32:22 +12:00
export const fetchComponentLibDefinitions = async appId => {
const LIB_DEFINITION_URL = `/api/${appId}/components/definitions`
try {
2020-06-04 07:35:30 +12:00
const libDefinitionResponse = await get(LIB_DEFINITION_URL)
2020-05-07 21:53:34 +12:00
return await libDefinitionResponse.json()
} catch (err) {
2020-05-07 21:53:34 +12:00
console.error(`Error fetching component definitions for ${appId}`, err)
}
2020-05-07 21:53:34 +12:00
}