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 {
|
else {
|
||||||
try {
|
try {
|
||||||
const me = await masto.accounts.verifyCredentials()
|
const [me, server] = await Promise.all([
|
||||||
|
masto.accounts.verifyCredentials(),
|
||||||
|
masto.instances.fetch(),
|
||||||
|
])
|
||||||
|
|
||||||
user.account = me
|
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))
|
if (!users.value.some(u => u.server === user.server && u.token === user.token))
|
||||||
users.value.push(user as UserLogin)
|
users.value.push(user as UserLogin)
|
||||||
|
|
||||||
currentUserId.value = me.id
|
|
||||||
servers.value[me.id] = await masto.instances.fetch()
|
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
await signout()
|
await signout()
|
||||||
|
|
Loading…
Reference in a new issue