🐛 fix(API/index.ts): add frontend_node parameter to checkPrompt function to fix validation errors

The checkPrompt function was not properly validating prompts due to missing frontend_node parameter. The fix adds the frontend_node parameter to the function and passes it to the axios.post request.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-27 17:59:57 -03:00
commit c0b1a12766

View file

@ -4,6 +4,7 @@ import {
errorsTypeAPI,
InitTypeAPI,
UploadFileTypeAPI,
APIClassType,
} from "./../../types/api/index";
import { APIObjectType, sendAllProps } from "../../types/api/index";
import axios, { AxiosResponse } from "axios";
@ -56,9 +57,13 @@ export async function postValidateCode(
* @returns {Promise<AxiosResponse<PromptTypeAPI>>} A promise that resolves to an AxiosResponse containing the validation results.
*/
export async function checkPrompt(
template: string
template: string,
frontend_node: APIClassType
): Promise<AxiosResponse<PromptTypeAPI>> {
return await axios.post("/api/v1/validate/prompt", { template });
return await axios.post("/api/v1/validate/prompt", {
template: template,
frontend_node: frontend_node,
});
}
/**