fix: 修复下载证书时提示token已过期的问题

This commit is contained in:
xiaojunnuo
2025-04-19 14:25:56 +08:00
parent 02b6351e13
commit 0e07ae6ce8
9 changed files with 103 additions and 79 deletions
@@ -41,6 +41,12 @@ export async function register(user: RegisterReq): Promise<UserInfoRes> {
data: user,
});
}
export async function logout() {
return await request({
url: "/logout",
method: "post",
});
}
export async function login(data: LoginReq): Promise<LoginRes> {
//如果开启了登录与权限模块,则真实登录
@@ -108,9 +108,10 @@ export const useUserStore = defineStore({
/**
* @description: logout
*/
logout(goLogin = true) {
async logout(goLogin = true) {
this.resetState();
resetAllStores();
await UserApi.logout(); //主要是清空cookie
goLogin && router.push("/login");
mitter.emit("app.logout");
},