chore: sse close before logout
This commit is contained in:
parent
6b9c048d13
commit
cd526828b3
@ -91,6 +91,14 @@ export function doLogout() {
|
||||
return requestClient.post<void>('/auth/logout');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭sse连接
|
||||
* @returns void
|
||||
*/
|
||||
export function seeConnectionClose() {
|
||||
return requestClient.get<void>('/resource/sse/close');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param companyName 租户/公司名称
|
||||
* @param domain 绑定域名(不带http(s)://) 可选
|
||||
|
@ -81,10 +81,8 @@ const avatar = computed(() => {
|
||||
});
|
||||
|
||||
async function handleLogout() {
|
||||
// resetAllStores();
|
||||
await authStore.logout();
|
||||
resetRoutes();
|
||||
// await router.replace(LOGIN_PATH);
|
||||
authStore.logout();
|
||||
}
|
||||
|
||||
const notifyStore = useNotifyStore();
|
||||
|
@ -10,7 +10,7 @@ import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores';
|
||||
import { notification } from 'ant-design-vue';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import { doLogout, getUserInfoApi, loginApi } from '#/api';
|
||||
import { doLogout, getUserInfoApi, loginApi, seeConnectionClose } from '#/api';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
@ -73,7 +73,9 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
}
|
||||
|
||||
async function logout(redirect: boolean = true) {
|
||||
console.log(accessStore.accessToken);
|
||||
try {
|
||||
await seeConnectionClose();
|
||||
await doLogout();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
Loading…
Reference in New Issue
Block a user