授权失败跳转
This commit is contained in:
+5
-1
@@ -174,9 +174,9 @@ service.interceptors.response.use(
|
||||
// 直接返回响应数据(根据后端接口规范调整)
|
||||
// console.log(response.data.code);
|
||||
if (response.data.code === 403) {
|
||||
localStorage.removeItem("token");
|
||||
// 如果在微信浏览器中,自动重新授权
|
||||
if (WechatAuth.isWechatBrowser() && !isAuthing) {
|
||||
localStorage.removeItem("token");
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const friend_account_id = urlParams.get('friend_account_id');
|
||||
const accountId = urlParams.get('accountId');
|
||||
@@ -185,6 +185,10 @@ service.interceptors.response.use(
|
||||
window.location.reload();
|
||||
}
|
||||
// return Promise.reject(new Error('正在重新授权,请稍候...'));
|
||||
}else{
|
||||
//跳转h5登录
|
||||
window.location.href = '/login?redirect='+encodeURIComponent(window.location.href);
|
||||
return Promise.reject(new Error('正在重新授权,请稍候...'));
|
||||
}
|
||||
}
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user