fix(login): logout

This commit is contained in:
zhangheng
2026-04-13 14:35:18 +08:00
parent 6baeae111e
commit a4b1d07e52
2 changed files with 5 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ fetch 参数:
"use client"
import { useUserStore } from "@/app/store/user"
import { usePermissionStore } from "@/components/label/store/auth"
import { deleteCookie, refreshKey } from "@/components/login/api"
import { isNumber } from "@/libs/util"
@@ -40,6 +41,7 @@ interface OptionsProps {
async function httpfetch<T>(options: OptionsProps): Promise<T> {
const { removeUserInfo, refreshToken } = useUserStore.getState()
const { logout } = usePermissionStore.getState()
const access_token = useUserStore.getState().access_token
const refresh_token = useUserStore.getState().refresh_token
@@ -197,6 +199,7 @@ async function httpfetch<T>(options: OptionsProps): Promise<T> {
} finally {
// 清空身份信息并跳转至登录页面
removeUserInfo()
logout()
window.location.href = "/login"
}
}
@@ -241,6 +244,7 @@ async function httpfetch<T>(options: OptionsProps): Promise<T> {
} finally {
// 清空身份信息并跳转至登录页面
removeUserInfo()
logout()
window.location.href = "/login"
}
} else if (status >= 510) {