backoffice/web/js/library.js

28 lines
632 B
JavaScript

function checkToken(){
instance.get("token", { withCredentials: true})
.then(function(response) {
if(location.pathname == "/")
{
location.href="/html/home.html";
}
})
.catch(function(error){
if(location.pathname != "/"){
location.href="/";
}
});
}
function signOut(){
document.getElementById("signout").addEventListener("click", function(){
instance.delete("token" , {withCredentials:true}).then(function(response){
if(response.status == 200){
location.href="/"
}
});
});
}