szurubooru/public_html/js/Bootstrap.js

29 lines
573 B
JavaScript
Raw Normal View History

2014-08-31 23:22:56 +02:00
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);
}
}
};
App.DI.registerSingleton('bootstrap', App.Bootstrap);
App.DI.registerManual('jQuery', function() { return $; });
2014-09-01 00:22:17 +02:00
App.DI.get('bootstrap');