szurubooru/public_html/js/Bootstrap.js
2014-10-18 18:48:16 +02:00

33 lines
635 B
JavaScript

var App = App || {};
App.Bootstrap = function(auth, router) {
auth.tryLoginFromCookie()
.then(startRouting)
.catch(function(error) {
auth.loginAnonymous()
.then(startRouting)
.catch(function(response) {
console.log(response);
alert('Fatal authentication error: ' + response.json.error);
});
});
function startRouting() {
try {
router.start();
} catch (err) {
console.log(err);
}
}
return {
startRouting: startRouting,
};
};
App.DI.registerSingleton('bootstrap', App.Bootstrap);
App.DI.registerManual('jQuery', function() { return $; });
var bootstrap = App.DI.get('bootstrap');