hippofish/packages/client/src/me.ts

15 lines
478 B
TypeScript
Raw Normal View History

2024-03-28 17:26:52 +01:00
import { reactive } from "vue";
2024-03-30 17:30:50 +01:00
import type { Account } from "@/account";
const accountData = localStorage.getItem("account");
// TODO: 外部からはreadonlyに
2024-03-07 03:06:45 +01:00
export const me = accountData
? reactive(JSON.parse(accountData) as Account)
: null;
2024-03-07 03:06:45 +01:00
export const isSignedIn = me != null;
export const isModerator = me != null && (me.isModerator || me.isAdmin);
export const isEmojiMod = isModerator || me?.emojiModPerm !== "unauthorized";
export const isAdmin = me?.isAdmin;