Skip to content

Bug: 偏好设置与刷新token问题 #6187

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

Open
5 tasks done
elkon028 opened this issue May 14, 2025 · 0 comments
Open
5 tasks done

Bug: 偏好设置与刷新token问题 #6187

elkon028 opened this issue May 14, 2025 · 0 comments

Comments

@elkon028
Copy link

elkon028 commented May 14, 2025

Version

Vben Admin V5

Describe the bug?

问题描述

  • src/preferences.ts 偏好设置
export const overridesPreferences = defineOverridesPreferences({
  // overrides
  app: {
    name: import.meta.env.VITE_APP_TITLE,
    enableRefreshToken: true, // 启用token刷新
  },
  breadcrumb: {
    styleType: 'background',
  },
  copyright: {
    enable: false,
    companyName: '',
    companySiteLink: '',
    date: '',
  },
  footer: {
    enable: false,
  },
  theme: {
    mode: 'light',
    radius: '0.25',
    builtinType: 'deep-green', // 内置主题设置
    semiDarkSidebar: true,
  },
  transition: {
    name: 'fade',
  },
})

问题1: 其中 app.theme.builtinType 设置默认初始状态下在偏好设置面板中生效了,页面内未生效(需要在偏好设置面板中手动切换一下才生效)

Image

问题2: token 过期的处理

  • packages/effects/request/src/request-client/preset-interceptors.ts
  • authenticateResponseInterceptor 拦截器
  • 只能处理 response.status === 401 的情况
  • 不能处理response.data.code === 401 的情况
  • 有些第三方 API 后台状态码并未放在 httpStatus上,而是放在response.data.code上的(比如https://github.com/YunaiV/ruoyi-vue-pro)
  • 虽然可以自己去 errorMessageResponseInterceptor 拦截器 处理这个逻辑
  • 不过更希望官方能在 authenticateResponseInterceptor 拦截器 中实现

Reproduction

System Info

System:
    OS: macOS 15.4.1
    CPU: (14) arm64 Apple M3 Max
    Memory: 122.42 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 136.0.7103.93

Relevant log output

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant