优化某些情况下登录权限问题

master
paulGao 2022-07-06 16:22:46 +08:00
parent 93fc20c825
commit 7633f84385
1 changed files with 23 additions and 24 deletions

View File

@ -112,7 +112,7 @@ http.interceptors.response.use(
// cleanStorage();
// isRefreshing = false;
// }
console.log(response)
let token = storage.getAccessToken();
if (
(token && response.statusCode === 403) ||
@ -131,7 +131,7 @@ http.interceptors.response.use(
response.header.accessToken = `${accessToken}`;
// token 刷新后将数组的方法重新执行
console.log('接口队列',requests,'新token',accessToken)
// console.log('接口队列', requests, '新token', accessToken)
requests.forEach((cb) => cb(accessToken));
requests = []; // 重新请求完清空
return http.request(response.config);
@ -154,13 +154,12 @@ http.interceptors.response.use(
});
});
}
// 如果当前返回没登录
} else if (
(!token && !storage.getRefreshToken() && response.statusCode === 403) ||
response.data.code === 403
response.data.code === 403 || response.data.code === 20004
) {
console.log('没有token 以及刷新token 内容',token,storage.getRefreshToken())
// console.log('没有token 以及刷新token 内容', token, storage.getRefreshToken())
cleanStorage();
// 如果当前状态码为正常但是success为不正常时