1
0
Fork 0
mirror of synced 2024-07-02 05:00:33 +12:00
appwrite/public/scripts/init.js

21 lines
537 B
JavaScript
Raw Normal View History

2019-05-09 18:54:39 +12:00
// Init
2019-05-09 20:01:51 +12:00
window.ls.error = function () {
2019-05-09 18:54:39 +12:00
return function (error) {
alert(error);
console.error('ERROR-APP', error);
}
};
window.addEventListener('error', function (event) {
2019-05-09 20:01:51 +12:00
alert(event.error.message);
2019-05-09 18:54:39 +12:00
console.error('ERROR-EVENT:', event.error.message, event.error.stack);
});
2019-05-09 20:01:51 +12:00
document.addEventListener('logout', function () {
2019-08-08 18:11:47 +12:00
window.location = '/auth/signin';
2019-05-09 18:54:39 +12:00
});
document.addEventListener('http-get-401', function() { /* on error */
document.dispatchEvent(new CustomEvent('logout'));
}, true);