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:
parent
cfa7dd6800
commit
08b20e18cb
2 changed files with 8 additions and 2 deletions
|
|
@ -325,3 +325,10 @@ export async function postBuildInit(
|
||||||
export async function UpdateTemplate(type:string, template:APITemplateType):Promise<AxiosResponse<{template:APITemplateType}>>{
|
export async function UpdateTemplate(type:string, template:APITemplateType):Promise<AxiosResponse<{template:APITemplateType}>>{
|
||||||
return await axios.get(`/dynamic_node`);
|
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 });
|
||||||
|
}
|
||||||
|
|
@ -92,10 +92,9 @@ export default function CodeAreaModal({
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
UpdateTemplate('code',nodeClass).then((apiReturn) => {
|
postCustomComponent('code',nodeClass).then((apiReturn) => {
|
||||||
const data = apiReturn.data;
|
const data = apiReturn.data;
|
||||||
if (data) {
|
if (data) {
|
||||||
console.log(data)
|
|
||||||
setNodeClass(data);
|
setNodeClass(data);
|
||||||
setModalOpen(false);
|
setModalOpen(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue