fix(login): logout
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user