1
This commit is contained in:
@@ -14,8 +14,10 @@ apiClient.interceptors.response.use((response) => response, (error) => {
|
|||||||
const { status, data } = error.response;
|
const { status, data } = error.response;
|
||||||
// 未登录 → 跳转登录页
|
// 未登录 → 跳转登录页
|
||||||
if (status === 401) {
|
if (status === 401) {
|
||||||
// 避免在登录页循环跳转
|
// 登录页本身(普通/内部)的 401 是"密码错误",留在原地显示提示
|
||||||
if (window.location.pathname !== '/login') {
|
const path = window.location.pathname;
|
||||||
|
const isLoginPage = path === '/login' || path === '/internal-login';
|
||||||
|
if (!isLoginPage) {
|
||||||
window.location.href = '/login';
|
window.location.href = '/login';
|
||||||
}
|
}
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
|
|||||||
@@ -19,8 +19,10 @@ apiClient.interceptors.response.use(
|
|||||||
|
|
||||||
// 未登录 → 跳转登录页
|
// 未登录 → 跳转登录页
|
||||||
if (status === 401) {
|
if (status === 401) {
|
||||||
// 避免在登录页循环跳转
|
// 登录页本身(普通/内部)的 401 是"密码错误",留在原地显示提示
|
||||||
if (window.location.pathname !== '/login') {
|
const path = window.location.pathname
|
||||||
|
const isLoginPage = path === '/login' || path === '/internal-login'
|
||||||
|
if (!isLoginPage) {
|
||||||
window.location.href = '/login'
|
window.location.href = '/login'
|
||||||
}
|
}
|
||||||
return Promise.reject(error)
|
return Promise.reject(error)
|
||||||
|
|||||||
Reference in New Issue
Block a user