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

fix: bug 修复鉴权时GetInfo与Logout双双失效导致路由死循环 #1231

Merged
merged 1 commit into from Aug 17, 2021

Conversation

sammeishi
Copy link
Contributor

@sammeishi sammeishi commented Aug 17, 2021

在src/permission.js鉴权时有以下流程:
1 store
2 .dispatch('GetInfo')
3 .catch(()=>{
4 store.dispatch('Logout').then(()=>{
5 next({ path: loginRoutePath, query: { redirect: to.fullPath } })
6 })
7 })
2行GetInfo如果异常catch会触发store的Logout(4行),而Logout也失败catch会直接resolve导致路由到loginRoutePath(5行),
loginRoutePath会再次加载src/permission.js运行store.dispatch('GetInfo'),从此死循环开始。。。

First of all, thank you for your contribution! 😄

Pull request will be merged after one of collaborators approve.
Please makes sure that these form are filled before submitting your pull request, thank you!

这个变动的性质是

  • 新特性提交
  • [- ] 日常 bug 修复
  • 文档改进
  • 组件样式改进
  • 重构
  • 代码风格优化
  • 分支合并
  • 其他改动(是关于什么的改动?)

需求背景

  1. 描述相关需求的来源。
  2. 要解决的问题。
  3. 相关的 issue 讨论链接。

实现方案和 API(非新功能可选)

  1. 基本的解决思路和其他可选方案。
  2. 列出最终的 API 实现和用法。
  3. 涉及UI/交互变动需要有截图或 GIF。

对用户的影响和可能的风险(非新功能可选)

  1. 这个改动对用户端是否有影响?影响的方面有哪些?
  2. 是否有可能隐含的 break change 和其他风险?

Changelog 描述(非新功能可选)

  1. 英文描述
  2. 中文描述(可选)

请求合并前的自查清单

  • [ -] 文档已补充或无须补充
  • [- ] 代码演示已提供或无须提供
  • Changelog 已提供或无须提供

后续计划(非新功能可选)

如果这个提交后面还有相关的其他提交和跟进信息,可以写在这里。

在src/permission.js鉴权时有以下流程:
1 store
2 .dispatch('GetInfo')
3 .catch(()=>{
4   store.dispatch('Logout').then(()=>{
5        next({ path: loginRoutePath, query: { redirect: to.fullPath } })
6   })
7 })
2行GetInfo的失败catch会执行触发store的Logout(4行),而Logout也失败不catch会直接resolve导致路由到loginRoutePath(5行),
loginRoutePath会再次加载src/permission.js运行store.dispatch('GetInfo'),从此死循环开始。。。
@sendya sendya merged commit 4747677 into vueComponent:master Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants