diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2024-10-21 19:59:20 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2024-10-21 19:59:20 +0900 |
| commit | 70b2a8f72e7efc488b8c286e2da8cffa11331eab (patch) | |
| tree | c61c486cb6b706c2f203b866b8dab36d4ac37dba /packages/frontend/src/account.ts | |
| parent | fix(frontend): MkSelectでmodelValueが更新されない限り値を更新... (diff) | |
| download | misskey-70b2a8f72e7efc488b8c286e2da8cffa11331eab.tar.gz misskey-70b2a8f72e7efc488b8c286e2da8cffa11331eab.tar.bz2 misskey-70b2a8f72e7efc488b8c286e2da8cffa11331eab.zip | |
fix(frontend): /iのレスポンスに含まれないプロパティが消えずに残り続ける問題を修正
Diffstat (limited to 'packages/frontend/src/account.ts')
| -rw-r--r-- | packages/frontend/src/account.ts | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/packages/frontend/src/account.ts b/packages/frontend/src/account.ts index b91834b94f..f5a74a0581 100644 --- a/packages/frontend/src/account.ts +++ b/packages/frontend/src/account.ts @@ -5,12 +5,12 @@ import { defineAsyncComponent, reactive, ref } from 'vue'; import * as Misskey from 'misskey-js'; +import { apiUrl } from '@@/js/config.js'; +import type { MenuItem, MenuButton } from '@/types/menu.js'; import { showSuspendedDialog } from '@/scripts/show-suspended-dialog.js'; import { i18n } from '@/i18n.js'; import { miLocalStorage } from '@/local-storage.js'; -import type { MenuItem, MenuButton } from '@/types/menu.js'; import { del, get, set } from '@/scripts/idb-proxy.js'; -import { apiUrl } from '@@/js/config.js'; import { waiting, popup, popupMenu, success, alert } from '@/os.js'; import { misskeyApi } from '@/scripts/misskey-api.js'; import { unisonReload, reloadChannel } from '@/scripts/unison-reload.js'; @@ -165,7 +165,18 @@ function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Pr }); } -export function updateAccount(accountData: Partial<Account>) { +export function updateAccount(accountData: Account) { + if (!$i) return; + for (const key of Object.keys($i)) { + delete $i[key]; + } + for (const [key, value] of Object.entries(accountData)) { + $i[key] = value; + } + miLocalStorage.setItem('account', JSON.stringify($i)); +} + +export function updateAccountPartial(accountData: Partial<Account>) { if (!$i) return; for (const [key, value] of Object.entries(accountData)) { $i[key] = value; |