feat(API): add postCustomComponent function to create custom components

fix(modals): replace UpdateTemplate function with postCustomComponent function to create custom components
This commit is contained in:
anovazzi1 2023-06-27 16:26:27 -03:00
commit 08b20e18cb
2 changed files with 8 additions and 2 deletions

View file

@ -325,3 +325,10 @@ export async function postBuildInit(
export async function UpdateTemplate(type:string, template:APITemplateType):Promise<AxiosResponse<{template:APITemplateType}>>{
return await axios.get(`/dynamic_node`);
}
export async function postCustomComponent(
code: string,
apiClass: APIClassType
): Promise<AxiosResponse<APIClassType>> {
return await axios.post(`/api/v1/custom_component`, { code });
}

View file

@ -92,10 +92,9 @@ export default function CodeAreaModal({
})
}
);
UpdateTemplate('code',nodeClass).then((apiReturn) => {
postCustomComponent('code',nodeClass).then((apiReturn) => {
const data = apiReturn.data;
if (data) {
console.log(data)
setNodeClass(data);
setModalOpen(false);
}