From fa56d6ea57a90ea9fbfff840e0e4ad3e96253764 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Wed, 27 Nov 2024 11:18:04 +0900 Subject: [PATCH] fix --- packages/frontend/src/account.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/frontend/src/account.ts b/packages/frontend/src/account.ts index aed128521e..36186ecac1 100644 --- a/packages/frontend/src/account.ts +++ b/packages/frontend/src/account.ts @@ -22,7 +22,7 @@ type Account = Misskey.entities.MeDetailed & { token: string }; const accountData = miLocalStorage.getItem('account'); // TODO: 外部からはreadonlyに -export let $i = accountData ? reactive(JSON.parse(accountData) as Account) : null; +export const $i = accountData ? reactive(JSON.parse(accountData) as Account) : null; export const iAmModerator = $i != null && ($i.isAdmin === true || $i.isModerator === true); export const iAmAdmin = $i != null && $i.isAdmin; @@ -178,18 +178,10 @@ export function updateAccount(accountData: Account) { export function updateAccountPartial(accountData: Partial) { if (!$i) return; - - if (accountData === null) { - void fetchAccount($i.token).then((accountData) => { - $i = accountData; - miLocalStorage.setItem('account', JSON.stringify($i)); - }); - } else { - for (const [key, value] of Object.entries(accountData)) { - $i[key] = value; - } - miLocalStorage.setItem('account', JSON.stringify($i)); + for (const [key, value] of Object.entries(accountData)) { + $i[key] = value; } + miLocalStorage.setItem('account', JSON.stringify($i)); } export async function refreshAccount() {