Improved a bit more the error prevention

This commit is contained in:
Tiago Ribeiro
2024-03-26 21:48:55 +00:00
parent bb7558afb8
commit 329ed573b3

View File

@@ -63,7 +63,9 @@ async function getCorrespondingStat(id: string, index: number): Promise<Stat> {
}
async function evaluate(body: Body): Promise<AxiosResponse> {
const backendRequest = await axios.post(`${process.env.BACKEND_URL}/writing_task${body.task.toString() || "1"}`, body as Body, {
const taskNumber = body.task.toString() !== "1" && body.task.toString() !== "2" ? "1" : body.task.toString();
const backendRequest = await axios.post(`${process.env.BACKEND_URL}/writing_task${taskNumber}`, body as Body, {
headers: {
Authorization: `Bearer ${process.env.BACKEND_JWT}`,
},