szurubooru/client/js/main.js
2016-04-11 21:43:58 +02:00

30 lines
969 B
JavaScript

'use strict';
require('./util/polyfill.js');
let controllers = [];
controllers.push(require('./controllers/auth_controller.js'));
controllers.push(require('./controllers/posts_controller.js'));
controllers.push(require('./controllers/users_controller.js'));
controllers.push(require('./controllers/help_controller.js'));
controllers.push(require('./controllers/comments_controller.js'));
controllers.push(require('./controllers/history_controller.js'));
controllers.push(require('./controllers/tags_controller.js'));
controllers.push(require('./controllers/home_controller.js'));
const events = require('./events.js');
const page = require('page');
for (let controller of controllers) {
controller.registerRoutes();
}
const api = require('./api.js');
api.loginFromCookies().then(() => {
page();
}).catch(errorMessage => {
page('/');
events.notify(
events.Error,
'An error happened while trying to log you in: ' + errorMessage);
});