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

25 lines
483 B
JavaScript
Raw Normal View History

2019-05-09 18:54:39 +12:00
// Init
window.ls.error = function() {
return function(error) {
console.error("ERROR-APP", error);
};
2019-05-09 18:54:39 +12:00
};
window.addEventListener("error", function(event) {
console.error("ERROR-EVENT:", event.error.message, event.error.stack);
2019-05-09 18:54:39 +12:00
});
document.addEventListener("logout", function() {
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
);