añadido logging de cerrar sesion + invalidacion de token
This commit is contained in:
@@ -80,10 +80,20 @@
|
||||
localStorage.setItem("theme", theme);
|
||||
};
|
||||
|
||||
function cerrarSesion() {
|
||||
localStorage.removeItem("email");
|
||||
sessionStorage.removeItem("token");
|
||||
navigate("/");
|
||||
async function cerrarSesion() {
|
||||
try{
|
||||
const req = await fetch($urlG+"/api/logout", {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Auth": token || "",
|
||||
}
|
||||
});
|
||||
|
||||
}finally{
|
||||
localStorage.removeItem("email");
|
||||
sessionStorage.removeItem("token");
|
||||
navigate("/");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user