Files
Situation-Awareness-Platfor…/src/utils/hooks/useLoginCheck.ts
2025-03-12 18:41:20 +08:00

20 lines
425 B
TypeScript

import { useAccountStore } from '@/stores/user';
import { emitEvent } from '@/utils/eventBus';
/**
* 验证登录转态,可触发登录操作
* @returns
*/
export function useLoginCheck() {
const account = useAccountStore();
const loginCheck = (triggerType?: string) => {
if (!account.isLogin) {
emitEvent('login', { triggerType });
}
return account.isLogin;
};
return {
loginCheck
};
}