disconnect click

This commit is contained in:
Valentin CZERYBA 2022-07-30 00:19:34 +02:00
parent 614a852fe6
commit a05f0db745
2 changed files with 8 additions and 1 deletions

View File

@ -94,7 +94,7 @@
<input class="form-control form-control-dark w-100 rounded-0 border-0" type="text" placeholder="Search" aria-label="Search">
<div class="navbar-nav">
<div class="nav-item text-nowrap">
<a class="nav-link px-3" href="#">Sign out</a>
<a class="nav-link px-3" id="signout" href="#">Sign out</a>
</div>
</div>
</header>

View File

@ -36,3 +36,10 @@ instance.get("users", {withCredentials: true, params :{ page:0, nbPages: nbPages
});
document.getElementById("signout").addEventListener("click", function(){
instance.delete("token" , {withCredentials:true}).then(function(response){
if(response.status == 200){
location.href="/"
}
});
});