Skip to content
New issue

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失效接口返回401后,路由进入login失效。 #1101

Closed
waney opened this issue Aug 20, 2021 · 2 comments
Closed

当token失效接口返回401后,路由进入login失效。 #1101

waney opened this issue Aug 20, 2021 · 2 comments

Comments

@waney
Copy link

waney commented Aug 20, 2021

⚠️ 重要 ⚠️ 在进一步操作之前,请检查下列选项。如果您忽视此模板或者没有提供关键信息,您的 Issue 将直接被关闭

描述 Bug

接口返回如下:

{"message":"Unauthenticated.","code":401,"result":[],"type":"error"}

控制台:

xhr.js:177 GET http://localhost:3100/api/me?_t=1629424659655 401 (Unauthorized)
dispatchXhrRequest @ xhr.js:177
xhrAdapter @ xhr.js:13
dispatchRequest @ dispatchRequest.js:52
Promise.then (async)
request @ Axios.js:61
wrap @ bind.js:9
(anonymous) @ Axios.ts:210
request @ Axios.ts:208
get @ Axios.ts:177
getUserInfo @ user.ts:32
getUserInfoAction @ user.ts:120
(anonymous) @ pinia.esm-bundler.js:1220
store.<computed> @ pinia.esm-bundler.js:836
(anonymous) @ permissionGuard.ts:75
(anonymous) @ vue-router.esm-bundler.js:1929
(anonymous) @ vue-router.esm-bundler.js:1903
(anonymous) @ vue-router.esm-bundler.js:3381
Promise.then (async)
(anonymous) @ vue-router.esm-bundler.js:3381
runGuardQueue @ vue-router.esm-bundler.js:3381
(anonymous) @ vue-router.esm-bundler.js:3067
Promise.then (async)
navigate @ vue-router.esm-bundler.js:3060
pushWithRedirect @ vue-router.esm-bundler.js:2995
push @ vue-router.esm-bundler.js:2931
install @ vue-router.esm-bundler.js:3345
use @ runtime-core.esm-bundler.js:3408
setupRouter @ index.ts:36
bootstrap @ main.ts:42
async function (async)
bootstrap @ main.ts:39
(anonymous) @ main.ts:60
vue-router.esm-bundler.js:72 [Vue Router warn]: uncaught error during route navigation:
warn @ vue-router.esm-bundler.js:72
triggerError @ vue-router.esm-bundler.js:3262
(anonymous) @ vue-router.esm-bundler.js:2999
Promise.catch (async)
pushWithRedirect @ vue-router.esm-bundler.js:2996
push @ vue-router.esm-bundler.js:2931
install @ vue-router.esm-bundler.js:3345
use @ runtime-core.esm-bundler.js:3408
setupRouter @ index.ts:36
bootstrap @ main.ts:42
async function (async)
bootstrap @ main.ts:39
(anonymous) @ main.ts:60
vue-router.esm-bundler.js:3264 Error: Request failed with status code 401
    at createError (createError.js:16)
    at settle (settle.js:17)
    at XMLHttpRequest.handleLoad (xhr.js:62)
triggerError @ vue-router.esm-bundler.js:3264
(anonymous) @ vue-router.esm-bundler.js:2999
Promise.catch (async)
pushWithRedirect @ vue-router.esm-bundler.js:2996
push @ vue-router.esm-bundler.js:2931
install @ vue-router.esm-bundler.js:3345
use @ runtime-core.esm-bundler.js:3408
setupRouter @ index.ts:36
bootstrap @ main.ts:42
async function (async)
bootstrap @ main.ts:39
(anonymous) @ main.ts:60
vue-router.esm-bundler.js:72 [Vue Router warn]: Unexpected error when starting the router: Error: Request failed with status code 401
    at createError (createError.js:16)
    at settle (settle.js:17)
    at XMLHttpRequest.handleLoad (xhr.js:62)
warn @ vue-router.esm-bundler.js:72
(anonymous) @ vue-router.esm-bundler.js:3347
Promise.catch (async)
install @ vue-router.esm-bundler.js:3345
use @ runtime-core.esm-bundler.js:3408
setupRouter @ index.ts:36
bootstrap @ main.ts:42
async function (async)
bootstrap @ main.ts:39
(anonymous) @ main.ts:60
main.ts:57 Uncaught (in promise) Error: Request failed with status code 401
    at createError (createError.js:16)
    at settle (settle.js:17)
    at XMLHttpRequest.handleLoad (xhr.js:62)

复现 Bug

步骤:1、正常登录情况下 2、后端销毁token 3、刷新页面 4、地址栏已更改,但页面停在loading。

该情况仅在刷新页面的时候出现,直接在页面上点击导航能正常进入页面。

2

系统信息

  • 操作系统:
  • Node 版本:
  • 包管理器 (npm/yarn/pnpm) 及其版本:
@cuteCloud
Copy link

我也碰到了 你解决了吗

@waney
Copy link
Author

waney commented Sep 26, 2021

已经修复过了。

@github-actions github-actions bot locked and limited conversation to collaborators Sep 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants