1
0
Fork 0
mirror of synced 2024-07-04 06:00:53 +12:00
appwrite/public/scripts/init.js

28 lines
795 B
JavaScript
Raw Normal View History

2019-05-09 18:54:39 +12:00
// Init
Raven.config('https://a9388b4e324f48f8afd4558cb8d3e8fc@sentry.io/1225344').install();
window.Litespeed = app(APP_ENV.VERSION);
window.Litespeed.error = function () {
return function (error) {
alert(error);
console.error('ERROR-APP', error);
}
};
window.addEventListener('error', function (event) {
alert(error.error.message);
console.error('ERROR-EVENT:', event.error.message, event.error.stack);
});
document.addEventListener('logout', function (event) {
var state = window.Litespeed.container.get('state');
if(state.getCurrent().view.scope === 'console') {
state.change('/auth/signin');
}
});
document.addEventListener('http-get-401', function() { /* on error */
document.dispatchEvent(new CustomEvent('logout'));
}, true);