refactor: localStorageのaccountsはindexedDBで保持するように (#7609)

* accountsストアはindexedDBで保持するように

* fix lint

* fix indexeddb available detection

* remove debugging code

* fix lint

* resolve https://github.com/misskey-dev/misskey/pull/7609/files/ba756204b77ce6e1189b8443e9641f2d02119621#diff-f565878e8202f0037b830c780b7c0932dc1bb5fd3d05ede14d72d10efbc3740c
Firefoxでの動作を改善

* fix lint

* fix lint

* add changelog
This commit is contained in:
tamaina 2021-08-20 19:38:16 +09:00 committed by GitHub
parent 60e768436e
commit fc56b12690
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 112 additions and 28 deletions

View file

@ -121,7 +121,7 @@ export default defineComponent({
},
async openAccountMenu(ev) {
const storedAccounts = getAccounts().filter(x => x.id !== this.$i.id);
const storedAccounts = await getAccounts().then(accounts => accounts.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);
},