mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Added frontend outline
This commit is contained in:
33
public_html/js/Bootstrap.js
Normal file
33
public_html/js/Bootstrap.js
Normal file
@ -0,0 +1,33 @@
|
||||
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');
|
Reference in New Issue
Block a user