import { computed } from "vue";
import { useUserStoreHook } from "/@/store/modules/user";

export function useUserInfo() {
  const userStore = useUserStoreHook();

  const isSuperUser = computed(() => userStore.isSuperUser);
  const userInfo = computed(() => userStore.info);

  const userLevel = computed(() => {
    const { level } = userStore;
    return level;
  });
  const setUserLevel = (level: string) => userStore.SET_LEVEL(level);

  return {
    setUserLevel,
    isSuperUser,
    userLevel,
    userInfo
  };
}
