fix: when the api returns 401, the page is refreshed not as expected (#4440)

This commit is contained in:
Vben 2024-09-19 23:03:20 +08:00 committed by GitHub
parent 4765158510
commit df48409814
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 37 additions and 5 deletions

View File

@ -76,7 +76,11 @@ export const useAuthStore = defineStore('auth', () => {
}
async function logout(redirect: boolean = true) {
await logoutApi();
try {
await logoutApi();
} catch {
// 不做任何处理
}
resetAllStores();
accessStore.setLoginExpired(false);

View File

@ -77,7 +77,11 @@ export const useAuthStore = defineStore('auth', () => {
}
async function logout(redirect: boolean = true) {
await logoutApi();
try {
await logoutApi();
} catch {
// 不做任何处理
}
resetAllStores();
accessStore.setLoginExpired(false);

View File

@ -77,7 +77,11 @@ export const useAuthStore = defineStore('auth', () => {
}
async function logout(redirect: boolean = true) {
await logoutApi();
try {
await logoutApi();
} catch {
// 不做任何处理
}
resetAllStores();
accessStore.setLoginExpired(false);

View File

@ -6,6 +6,14 @@ outline: deep
框架提供的抽屉组件,支持`自动高度`、`loading`等功能。
> 如果文档内没有参数说明,可以尝试在在线示例内寻找
::: info 写在前面
如果你觉得现有组件的封装不够理想,或者不完全符合你的需求,大可以直接使用原生组件,亦或亲手封装一个适合的组件。框架提供的组件并非束缚,使用与否,完全取决于你的需求与自由。
:::
## 基础用法
使用 `useVbenDrawer` 创建最基础的模态框。

View File

@ -6,6 +6,14 @@ outline: deep
框架提供的模态框组件,支持`拖拽`、`全屏`、`自动高度`、`loading`等功能。
> 如果文档内没有参数说明,可以尝试在在线示例内寻找
::: info 写在前面
如果你觉得现有组件的封装不够理想,或者不完全符合你的需求,大可以直接使用原生组件,亦或亲手封装一个适合的组件。框架提供的组件并非束缚,使用与否,完全取决于你的需求与自由。
:::
## 基础用法
使用 `useVbenModal` 创建最基础的模态框。

View File

@ -2,7 +2,7 @@
::: info README
该文档介绍的是框架组件的使用方法、属性、事件等。如果你觉得组件封装的不好,或者不符合你的需求,你可以直接使用原生的组件,或者自己封装一个组件,不需要拘泥于框架提供的组件。我们只是提供了一些常用的组件,方便你快速开发。是否使用,取决于你的需求
该文档介绍的是框架组件的使用方法、属性、事件等。如果你觉得现有组件的封装不够理想,或者不完全符合你的需求,大可以直接使用原生组件,亦或亲手封装一个适合的组件。框架提供的组件并非束缚,使用与否,完全取决于你的需求与自由
:::

View File

@ -77,7 +77,11 @@ export const useAuthStore = defineStore('auth', () => {
}
async function logout(redirect: boolean = true) {
await logoutApi();
try {
await logoutApi();
} catch {
// 不做任何处理
}
resetAllStores();
accessStore.setLoginExpired(false);