perf: fetch server and user details in parallel
This commit is contained in:
parent
8537c8ee54
commit
20d8aa7e75
|
@ -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