We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用时不关闭浏览器,过段时间双Token过期后,刷新页面,不会跳转到登录页,也不发起获取异步路由的请求,导致一直卡在左侧菜单的加载状态,只能手动退出登录才行。
与之前的一个问题类似 #493
疑惑的是,我简单调试了下看到代码逻辑中已经调用了 getAsyncRoutes 方法,按理说是发起了获取异步路由的请求,理论上会触发token过期的拦截从而跳转到登录页。但实际上在网络调试控制台并未看到发起该请求,从而出现一直卡在菜单loading的情况。
getAsyncRoutes
将精简版自带的3个mock接口改为实际可用的后台接口,同时在 src/utils/http/index.ts 的响应拦截中加入未登录的错误码处理逻辑即可。
src/utils/http/index.ts
如:
// 以下情况视为未登录、登录超时等,需要重新登录,跳转到登录页 if (response.status === 401 || [1021, 1022, 1023].includes(response.data.code)) { return useUserStoreHook().logOut(); }
No response
The text was updated successfully, but these errors were encountered:
token过期会自动请求刷新token 无需刷新页面
Sorry, something went wrong.
1、页面内容为静态,本身无请求。与刷新操作无关。 2、刷新页面未发起获取异步路由的请求,导致未进入请求响应拦截的处理逻辑,从而卡在菜单加载处
这个问题解决了吗?怎么解决的呀 @Rebuilding127 @xiaoxian521
@kunlong-luo 请求拦截白名单的地方要把登录接口和刷新Token接口加入白名单,我当时是改了接口地址但是白名单没改,就一直有这个问题,改了以后正常了。 另外如果页面是静态的没有任何请求的话,可能有问题,这个我后面没测试,你可以自己试试看。
No branches or pull requests
描述问题 (Describe the problem)
使用时不关闭浏览器,过段时间双Token过期后,刷新页面,不会跳转到登录页,也不发起获取异步路由的请求,导致一直卡在左侧菜单的加载状态,只能手动退出登录才行。
与之前的一个问题类似 #493
疑惑的是,我简单调试了下看到代码逻辑中已经调用了
getAsyncRoutes
方法,按理说是发起了获取异步路由的请求,理论上会触发token过期的拦截从而跳转到登录页。但实际上在网络调试控制台并未看到发起该请求,从而出现一直卡在菜单loading的情况。如何复现该问题 (How to reproduce the problem)
将精简版自带的3个mock接口改为实际可用的后台接口,同时在
src/utils/http/index.ts
的响应拦截中加入未登录的错误码处理逻辑即可。如:
操作系统和浏览器信息 (Operating system and browser information)
No response
验证 (Verify)
The text was updated successfully, but these errors were encountered: