diff --git a/src/utils/http/axios/index.ts b/src/utils/http/axios/index.ts index 8e572da..6db56d6 100644 --- a/src/utils/http/axios/index.ts +++ b/src/utils/http/axios/index.ts @@ -81,34 +81,30 @@ const transform: AxiosTransform = { case ResultEnum.UNAUTHRAZATION: timeoutMsg = t('登录超时,请重新登录!'); - if (data) { - let split = data.split('||'); - if (split.length > 1) { - let logoutMessage = split[1]; - // 跨页面配置 异常显示提醒 - sessionStorage.setItem('logoutInfoData', JSON.stringify({ - logoutType: split[0], - logoutMessage: logoutMessage, - })); - } - } - const userStore = useUserStoreWithOut(); userStore.setToken(undefined); if (!window.location.hash.includes('login')&&!window.location.pathname.includes('login') &&!window.location.hash.includes('tokenLogin')&&!window.location.pathname.includes('tokenLogin')) { userStore.logout(true); } - if(data.urlToRedirectTo){ - //登录页面不跳转 - if(!window.location.hash.includes('login')&&!window.location.pathname.includes('login') - &&!window.location.hash.includes('tokenLogin')&&!window.location.pathname.includes('tokenLogin')){ - window.location.href=data.urlToRedirectTo; + if (data) { + if(data.urlToRedirectTo){ + //登录页面不跳转 + if(!window.location.hash.includes('login')&&!window.location.pathname.includes('login') + &&!window.location.hash.includes('tokenLogin')&&!window.location.pathname.includes('tokenLogin')){ + window.location.href=data.urlToRedirectTo; + } + options.errorMessageMode="none"; + }else{ + // data 有logout 信息 ,存sessionStorage 给login page 弹框显示 + if (data.logoutMessage) { + sessionStorage.setItem('logoutInfoData', JSON.stringify({ + logoutMessage: data.logoutMessage, + })); + } + const go = useGo(); + go('/login'); } - options.errorMessageMode="none"; - }else{ - const go = useGo(); - go('/login'); } break; default: