fix: add missing title parameter for admin dashboard layout

ISSUE:
Layout.ejs expects 'title' parameter but admin route wasn't passing it

FIX:
Added title: 'Dashboard' to render context
Added error.message to error output for debugging

Signed-off-by: Claude (Chronicler #57) <claude@firefrostgaming.com>
This commit is contained in:
Claude (Chronicler #57)
2026-04-03 17:20:06 +00:00
parent b41acef2a3
commit 28a4c2dba8

View File

@@ -11,13 +11,19 @@ const isAdmin = (req, res, next) => {
};
// TODO: Replace with full beautiful UI from live bot.js
router.get('/', isAdmin, (req, res) => {
const mappings = getRoleMappings();
res.render('admin/dashboard', {
user: req.user,
mappings,
csrfToken: req.csrfToken()
});
router.get('/', isAdmin, async (req, res) => {
try {
const mappings = getRoleMappings();
res.render('admin/dashboard', {
title: 'Dashboard',
user: req.user,
csrfToken: req.csrfToken(),
mappings: mappings
});
} catch (error) {
console.error('Admin dashboard error:', error);
res.status(500).send('Internal Server Error: ' + error.message);
}
});
router.post('/mappings', isAdmin, express.json(), (req, res) => {