refactor: Remove unused function and fix code formatting

- Removed the `postCustomComponent` function from the API controller.
- Fixed formatting issues in the `CodeAreaModal` component.
- Removed unnecessary code comments and imports.

This commit simplifies the codebase and improves readability.
This commit is contained in:
Rodrigo Nader 2023-07-07 00:10:41 -03:00
commit 7a0ab93357
2 changed files with 4 additions and 17 deletions

View file

@ -338,11 +338,4 @@ export async function uploadFile(
const formData = new FormData();
formData.append("file", file);
return await axios.post(`/api/v1/upload/${id}`, formData);
}
export async function postCustomComponent(
code: string,
apiClass: APIClassType
): Promise<AxiosResponse<APIClassType>> {
return await axios.post(`/api/v1/custom_component`, { code });
}
}

View file

@ -7,7 +7,7 @@ import "ace-builds/src-noconflict/theme-twilight";
import "ace-builds/src-noconflict/ext-language_tools";
// import "ace-builds/webpack-resolver";
import { darkContext } from "../../contexts/darkContext";
import { postCustomComponent, postValidateCode } from "../../controllers/API";
import { postValidateCode } from "../../controllers/API";
import { alertContext } from "../../contexts/alertContext";
import {
Dialog,
@ -63,7 +63,8 @@ export default function CodeAreaModal({
setSuccessData({
title: "Code is ready to run",
});
// setValue(code);
setValue(code);
setModalOpen(false);
} else {
if (funcErrors.length !== 0) {
setErrorData({
@ -90,13 +91,6 @@ export default function CodeAreaModal({
title: "There is something wrong with this code, please review it",
});
});
postCustomComponent(code, nodeClass).then((apiReturn) => {
const data = apiReturn.data;
if (data) {
setNodeClass(data);
setModalOpen(false);
}
});
}
return (