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";
|
2023-10-22 23:29:46 +02:00
|
|
|
|
|
|
|
const accountData = localStorage.getItem("account");
|
|
|
|
|
|
|
|
// TODO: 外部からはreadonlyに
|
2024-03-07 03:06:45 +01:00
|
|
|
export const me = accountData
|
2023-10-22 23:29:46 +02:00
|
|
|
? reactive(JSON.parse(accountData) as Account)
|
|
|
|
: null;
|
2024-01-11 02:21:21 +01:00
|
|
|
|
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;
|