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 $i = accountData
|
|
? reactive(JSON.parse(accountData) as Account)
|
|
: null;
|
|
|
|
export const isSignedIn = $i != null;
|
|
export const isModerator = $i != null && ($i.isModerator || $i.isAdmin);
|
|
export const isEmojiMod = isModerator || $i?.emojiModPerm !== "unauthorized";
|
|
export const isAdmin = $i?.isAdmin;
|