refactor(frontend): アカウント情報はstore管理に
This commit is contained in:
parent
de19d9a4d4
commit
75267f87d5
5 changed files with 61 additions and 44 deletions
|
|
@ -157,7 +157,7 @@ async function init() {
|
|||
|
||||
const accounts = await getAccounts();
|
||||
|
||||
const accountIdsToFetch = accounts.map(a => a.user.id).filter(id => !users.value.has(id));
|
||||
const accountIdsToFetch = accounts.map(a => a.id).filter(id => !users.value.has(id));
|
||||
|
||||
if (accountIdsToFetch.length > 0) {
|
||||
const usersRes = await misskeyApi('users/show', {
|
||||
|
|
@ -169,7 +169,7 @@ async function init() {
|
|||
|
||||
users.value.set(user.id, {
|
||||
...user,
|
||||
token: accounts.find(a => a.user.id === user.id)!.token,
|
||||
token: accounts.find(a => a.id === user.id)!.token,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -879,7 +879,7 @@ async function post(ev?: MouseEvent) {
|
|||
|
||||
if (postAccount.value) {
|
||||
const storedAccounts = await getAccounts();
|
||||
token = storedAccounts.find(x => x.user.id === postAccount.value?.id)?.token;
|
||||
token = storedAccounts.find(x => x.id === postAccount.value?.id)?.token;
|
||||
}
|
||||
|
||||
posting.value = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue