mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-06 00:49:58 +00:00
perf: fetch server and user details in parallel
This commit is contained in:
parent
8537c8ee54
commit
20d8aa7e75
1 changed files with 7 additions and 4 deletions
|
@ -49,14 +49,17 @@ export async function loginTo(user?: Omit<UserLogin, 'account'> & { account?: Ac
|
|||
|
||||
else {
|
||||
try {
|
||||
const me = await masto.accounts.verifyCredentials()
|
||||
const [me, server] = await Promise.all([
|
||||
masto.accounts.verifyCredentials(),
|
||||
masto.instances.fetch(),
|
||||
])
|
||||
|
||||
user.account = me
|
||||
currentUserId.value = me.id
|
||||
servers.value[me.id] = server
|
||||
|
||||
if (!users.value.some(u => u.server === user.server && u.token === user.token))
|
||||
users.value.push(user as UserLogin)
|
||||
|
||||
currentUserId.value = me.id
|
||||
servers.value[me.id] = await masto.instances.fetch()
|
||||
}
|
||||
catch {
|
||||
await signout()
|
||||
|
|
Loading…
Reference in a new issue