Updated the eval calls to the backend, passed the navigation logic of level to useExamNavigation hook
This commit is contained in:
@@ -5,10 +5,12 @@ import { sessionOptions } from "@/lib/session";
|
||||
import axios from "axios";
|
||||
|
||||
interface Body {
|
||||
userId: string;
|
||||
sessionId: string;
|
||||
question: string;
|
||||
answer: string;
|
||||
exerciseId: string;
|
||||
task: 1 | 2;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export default withIronSessionApiRoute(handler, sessionOptions);
|
||||
@@ -20,13 +22,13 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
const body = req.body as Body;
|
||||
const taskNumber = body.task.toString() !== "1" && body.task.toString() !== "2" ? "1" : body.task.toString();
|
||||
const { task, ...body} = req.body as Body;
|
||||
const taskNumber = task.toString() !== "1" && task.toString() !== "2" ? "1" : task.toString();
|
||||
|
||||
await axios.post(`${process.env.BACKEND_URL}/grade/writing/${taskNumber}`, body, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${process.env.BACKEND_JWT}`,
|
||||
},
|
||||
});
|
||||
res.status(200);
|
||||
res.status(200).json({ok: true});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user