1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-02 01:39:31 +00:00

Added validation for individual class page

This commit is contained in:
2022-03-03 02:18:09 +00:00
parent 959576585d
commit 805d870755

View File

@@ -18,7 +18,19 @@ router.get('/classes', async (req, res) => {
}); });
router.get('/class/:id', async (req, res) => { router.get('/class/:id', async (req, res) => {
const c = await new Class(req.params.id); let c;
try {
c = await new Class(req.params.id);
} catch (e) {
return res.status(400).render('error', {
title: 'Stratos - Error',
current: 'Classes',
name: req.session.fullName,
code: 400,
msg: e.message
});
}
const linkRoot = `/class/${c.id}`; const linkRoot = `/class/${c.id}`;
return res.render('class', { return res.render('class', {