From a3ef6d9bf2ca94f556ae0b0e388813c85bee4eeb Mon Sep 17 00:00:00 2001 From: tamaina Date: Wed, 30 Jun 2021 00:18:52 +0900 Subject: [PATCH] fix: add await to new getAccounts() call --- src/client/pages/settings/accounts.vue | 10 +++++----- src/client/ui/default.sidebar.vue | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/client/pages/settings/accounts.vue b/src/client/pages/settings/accounts.vue index a3fa0d4eb0..459da96b8e 100644 --- a/src/client/pages/settings/accounts.vue +++ b/src/client/pages/settings/accounts.vue @@ -48,10 +48,10 @@ export default defineComponent({ title: this.$ts.accounts, icon: 'fas fa-users', }, - storedAccounts: getAccounts().filter(x => x.id !== this.$i.id), + storedAccounts: getAccounts().then(accounts => accounts.filter(x => x.id !== this.$i.id)), accounts: null, - init: () => os.api('users/show', { - userIds: this.storedAccounts.map(x => x.id) + init: async () => os.api('users/show', { + userIds: (await this.storedAccounts).map(x => x.id) }).then(accounts => { this.accounts = accounts; }), @@ -104,8 +104,8 @@ export default defineComponent({ }, 'closed'); }, - switchAccount(account: any) { - const storedAccounts = getAccounts(); + async switchAccount(account: any) { + const storedAccounts = await getAccounts(); const token = storedAccounts.find(x => x.id === account.id).token; this.switchAccountWithToken(token); }, diff --git a/src/client/ui/default.sidebar.vue b/src/client/ui/default.sidebar.vue index c7e2d30c7a..8c7e99bd68 100644 --- a/src/client/ui/default.sidebar.vue +++ b/src/client/ui/default.sidebar.vue @@ -121,7 +121,7 @@ export default defineComponent({ }, async openAccountMenu(ev) { - const storedAccounts = getAccounts().filter(x => x.id !== this.$i.id); + const storedAccounts = (await getAccounts()).filter(x => x.id !== this.$i.id); const accountsPromise = os.api('users/show', { userIds: storedAccounts.map(x => x.id) }); const accountItemPromises = storedAccounts.map(a => new Promise(res => { @@ -181,8 +181,8 @@ export default defineComponent({ }, 'closed'); }, - switchAccount(account: any) { - const storedAccounts = getAccounts(); + async switchAccount(account: any) { + const storedAccounts = await getAccounts(); const token = storedAccounts.find(x => x.id === account.id).token; this.switchAccountWithToken(token); },