szurubooru/static/js/controllers/auth_controller.js

35 lines
620 B
JavaScript
Raw Normal View History

'use strict';
class AuthController {
constructor(topNavigationController) {
this.topNavigationController = topNavigationController;
this.currentUser = null;
}
isLoggedIn() {
return this.currentUser !== null;
}
hasPrivilege() {
return true;
}
login(user) {
this.currentUser = user;
}
logout(user) {
this.currentUser = null;
}
loginRoute() {
this.topNavigationController.activate('login');
}
logoutRoute() {
this.topNavigationController.activate('logout');
}
}
module.exports = AuthController;