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

25 lines
483 B
JavaScript

// Init
window.ls.error = function() {
return function(error) {
console.error("ERROR-APP", error);
};
};
window.addEventListener("error", function(event) {
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
);