Commit 83c876f1 authored by guang.wu's avatar guang.wu

fix: 解决刷新token失败后不弹框问题

parent 8c7bdd80
...@@ -135,12 +135,12 @@ const refreshTokenTimeOut = debounce(() => { ...@@ -135,12 +135,12 @@ const refreshTokenTimeOut = debounce(() => {
* 未超过5小时,弹窗提示跳转新标签页登录 * 未超过5小时,弹窗提示跳转新标签页登录
* **/ * **/
const showLoginPopups = debounce(() => { const showLoginPopups = debounce(() => {
let href = window.location.href;
href = href.replace(/\?token=[a-z0-9\-A-Z]+/g, '');
href = instance._extend.loginUrl + '?url=' + window.btoa(href);
if (checkTokenTimeOut5Hours() || !instance._extend.modal) { if (checkTokenTimeOut5Hours() || !instance._extend.modal) {
window.location.href = instance._extend.loginUrl + '?url=' + window.btoa(href); window.location.href = href;
} else { } else {
let href = window.location.href;
href = href.replace(/\?token=[a-z0-9\-A-Z]+/g, '');
href = instance._extend.loginUrl + '?url=' + window.btoa(href);
instance._extend.modal.confirm({ instance._extend.modal.confirm({
title: '会话过期', title: '会话过期',
content: '当前会话已过期,请重新登录。', content: '当前会话已过期,请重新登录。',
...@@ -236,7 +236,7 @@ instance.interceptors.response.use( ...@@ -236,7 +236,7 @@ instance.interceptors.response.use(
// token过期; // token过期;
return refreshRequest(response.config); return refreshRequest(response.config);
} }
if (+code === 4010 || +code === 4011) { if (+code === 4010 || +code === 4011 || (code === '0001' && response.url.indexOf('oauth/refreshtoken') > -1)) {
showLoginPopups(); showLoginPopups();
return; return;
} }
......
{ {
"name": "@qg/sys-sdk", "name": "@qg/sys-sdk",
"version": "1.0.22", "version": "1.0.23",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment