jwt refresh token 1.0

This commit is contained in:
2025-09-21 17:49:55 +03:00
parent 639bc3c1a9
commit 5ddab94773
8 changed files with 95 additions and 19 deletions

View File

@@ -1,4 +1,13 @@
const token = localStorage.getItem("token");
if (!token) {
window.location.href = "./../login/index.html";
}
function tokenCheck(){
const token = localStorage.getItem("token") || sessionStorage.getItem("token");
if (!token) {
window.location.href = "./../login/index.html";
}
}
tokenCheck()
document.getElementById('logoutForm').addEventListener('submit', async function (e) {
e.preventDefault();
localStorage.removeItem("token");
tokenCheck();
});