add redirect from login
This commit is contained in:
parent
bd35ae416b
commit
4ff8a25c06
|
@ -22,13 +22,25 @@ async function apiLogin(req, res) {
|
||||||
}
|
}
|
||||||
const session = await user.createSession();
|
const session = await user.createSession();
|
||||||
req.session.user = session;
|
req.session.user = session;
|
||||||
res.send(req.session);
|
res.redirect('/admin/panel');
|
||||||
//res.redirect('/admin/panel');
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function panel(req, res) {
|
||||||
|
res.send(await Helpers.ViewLoader.load('admin/panel.pug', {
|
||||||
|
current_route: req.originalUrl
|
||||||
|
}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = (router) => {
|
module.exports = (router) => {
|
||||||
|
|
||||||
|
// login
|
||||||
router.get('/login', handler(login));
|
router.get('/login', handler(login));
|
||||||
router.get('/admin/login', handler(login));
|
router.get('/admin/login', handler(login));
|
||||||
router.post('/admin/login', handler(apiLogin));
|
router.post('/admin/login', handler(apiLogin));
|
||||||
|
|
||||||
|
// panel
|
||||||
|
router.get('/admin/panel', handler(panel));
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue