1
0
Fork 0
mirror of synced 2024-07-04 14:01:27 +12:00
budibase/packages/builder/src/builderStore/loadComponentLibraries.js
Keviin Åberg Kultalahti 4ec2e7d01f lint:fix
2021-05-03 09:31:09 +02:00

17 lines
587 B
JavaScript

import { get } from "builderStore/api"
/**
* 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
*/
export const fetchComponentLibDefinitions = async (appId) => {
const LIB_DEFINITION_URL = `/api/${appId}/components/definitions`
try {
const libDefinitionResponse = await get(LIB_DEFINITION_URL)
return await libDefinitionResponse.json()
} catch (err) {
console.error(`Error fetching component definitions for ${appId}`, err)
}
}