1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/lib/routes/admin-api/user.js
2020-02-20 08:34:17 +01:00

32 lines
619 B
JavaScript

'use strict';
const Controller = require('../controller');
class UserController extends Controller {
constructor() {
super();
this.get('/', this.getUser);
this.get('/logout', this.logout);
}
getUser(req, res) {
if (req.user) {
return res
.status(200)
.json(req.user)
.end();
} else {
return res.status(404).end();
}
}
logout(req, res) {
if (req.session) {
req.session = null;
}
res.redirect('/');
}
}
module.exports = UserController;