1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-10-19 13:56:43 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

localStorage操作统一使用localStorage.getItem,localStorage.removeItem;登录前判断用户名密码是否为空

This commit is contained in:
2022-04-06 11:11:23 +08:00
parent 4937cfb8e3
commit 69b46b5e97
9 changed files with 84 additions and 74 deletions

View File

@@ -38,8 +38,8 @@
}
if(!localStorage.getItem("token") || !localStorage.getItem("is_admin")) {
localStorage.clear("token");
localStorage.clear("is_admin");
localStorage.removeItem("token");
localStorage.removeItem("is_admin");
window.location.href = "/";
}
@@ -57,8 +57,8 @@
}
} else {
if(data.errCode == "20004") { // 登陆过期
localStorage.clear("token");
localStorage.clear("is_admin");
localStorage.removeItem("token");
localStorage.removeItem("is_admin");
window.location.href = "/login";
}
alert(`出错啦!${data.errMsg} (错误码: ${data.errCode}) `);