hippofish/packages/client/src/me.ts
2024-03-31 01:30:50 +09:00

14 lines
478 B
TypeScript

import { reactive } from "vue";
import type { Account } from "@/account";
const accountData = localStorage.getItem("account");
// TODO: 外部からはreadonlyに
export const me = accountData
? reactive(JSON.parse(accountData) as Account)
: null;
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;