1
0
Fork 0
mirror of synced 2024-06-30 04:00:34 +12:00
appwrite/public/scripts/init.js
2019-08-08 09:11:47 +03:00

21 lines
537 B
JavaScript

// Init
window.ls.error = function () {
return function (error) {
alert(error);
console.error('ERROR-APP', error);
}
};
window.addEventListener('error', function (event) {
alert(event.error.message);
console.error('ERROR-EVENT:', event.error.message, event.error.stack);
});
document.addEventListener('logout', function () {
window.location = '/auth/signin';
});
document.addEventListener('http-get-401', function() { /* on error */
document.dispatchEvent(new CustomEvent('logout'));
}, true);