fix indexeddb available detection

This commit is contained in:
tamaina
2021-07-27 01:44:50 +09:00
parent 66b4eaf72e
commit 8e14463215
5 changed files with 27 additions and 15 deletions

View File

@@ -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);
},