1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00
unleash.unleash/lib/routes/admin-api/user.js
2018-12-17 08:27:49 +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;