import { storeToRefs } from 'pinia';
import { useUserStore } from '@/store/modules/user';

const userStore = useUserStore();
const { getUserInfo } = storeToRefs(userStore);
/**
 * 获取登录账户信息
 */
export const useUserInfoHook = () => {
  const userInfo = getUserInfo.value;
  const id = userInfo.id;
  const staffNo = userInfo.staffNo;
  const realname = userInfo.realname;
  const permissions = userInfo.permissions;
  const menus = userInfo.menus;
  return {
    id,
    realname,
    permissions,
    staffNo,
    menus,
  };
};
