From cbef41f18bc6c9a315a7237570dad2461b97651f Mon Sep 17 00:00:00 2001 From: KhoaHocMai113 Date: Fri, 6 Oct 2023 08:31:06 +0700 Subject: [PATCH] update examPhase --- routes/examPhase.js | 12 ++++++------ routes/student.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/routes/examPhase.js b/routes/examPhase.js index d93ef642..6e587ccb 100644 --- a/routes/examPhase.js +++ b/routes/examPhase.js @@ -50,7 +50,7 @@ router.post('/', async (req, res) => { router.put('/', async (req, res) => { // Update ExamPhase const examPhaseUp = req.body - const id = parseInt(examPhaseUp.id) + const id = parseInt(examPhaseUp.examPhaseId) try { const check = await ExamPhase.update(examPhaseUp, { @@ -59,13 +59,13 @@ router.put('/', async (req, res) => { // Update ExamPhase } }) if (check[0] === 0) { - res.json(NotFoundResponse()) + res.json(MessageResponse("ExamPhase Update !")) } else { - res.json(MessageResponse('Exam Phase updated')) + res.status(500).json({ error: 'Internal Server Error' }); } } catch (error) { console.log(error) - res.json(MessageResponse('Error found')) + res.status(500).json({ error: 'Internal Server Error' }); } }) @@ -104,11 +104,11 @@ router.put('/updatePhase', async (req, res) => { } } ) - if(result){ + if (result) { res.json(MessageResponse("ExamPhase Update !")) } else { res.status(500).json({ error: 'Internal Server Error' }); - } + } } catch (error) { res.status(500).json({ error: 'Internal Server Error' }); } diff --git a/routes/student.js b/routes/student.js index 53e6dc68..6fbb9a85 100644 --- a/routes/student.js +++ b/routes/student.js @@ -34,7 +34,7 @@ router.post('/create', async (req, res) => { } catch (err) { console.log(err) res.json(InternalErrResponse()); - } + } }) export default router