mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-26 06:10:20 +01:00
fix
This commit is contained in:
parent
edd9a94ea8
commit
fa56d6ea57
1 changed files with 4 additions and 12 deletions
|
@ -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<Account>) {
|
||||
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() {
|
||||
|
|
Loading…
Reference in a new issue