jwt refresh token 1.0
This commit is contained in:
@@ -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();
|
||||
});
|
||||
Reference in New Issue
Block a user