fix: 修复用户登出的问题

This commit is contained in:
CaptainB 2022-10-12 11:50:52 +08:00 committed by 刘瑞斌
parent 9b1ab5c1fd
commit 57da59fafa
1 changed files with 5 additions and 0 deletions

View File

@ -61,10 +61,15 @@ function clearLocalStorage() {
localStorage.removeItem(TokenKey);
sessionStorage.removeItem(WORKSPACE_ID);
sessionStorage.removeItem(PROJECT_ID);
location.href = "/";
}
const checkAuth = response => {
// 请根据实际需求修改
if (!response.headers) {
clearLocalStorage();
return;
}
if (response.headers["authentication-status"] === "invalid" || response.status === 401) {
clearLocalStorage();
}