14 lines
478 B
TypeScript
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;
|