added redirect to completed form on form submission

This commit is contained in:
2025-11-20 00:38:50 -05:00
parent 3560268640
commit aad87096b5
4 changed files with 9 additions and 5 deletions

View File

@@ -59,8 +59,8 @@ eventRouter.post('/', async (req: Request, res: Response) => {
try {
console.log();
const data: CourseEventDetails = req.body;
await insertCourseEvent(data);
res.sendStatus(201);
const id = await insertCourseEvent(data);
res.status(201).json(id);
} catch (error) {
console.error('failed to post training', error);
res.status(500).json("failed to post training\n" + error)

View File

@@ -80,7 +80,7 @@ export async function insertCourseEvent(event: CourseEventDetails): Promise<numb
}
await con.commit();
await con.release();
return eventID;
return Number(eventID);
} catch (error) {
await con.rollback();
await con.release();