mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-03-31 11:46:37 +00:00
perf: run async operations in parallel in server load functions
This commit is contained in:
@@ -4,10 +4,15 @@ import WebAuthnService from '$lib/services/webauthn-service';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
export const load: PageServerLoad = async ({ cookies }) => {
|
||||
const webauthnService = new WebAuthnService(cookies.get(ACCESS_TOKEN_COOKIE_NAME));
|
||||
const userService = new UserService(cookies.get(ACCESS_TOKEN_COOKIE_NAME));
|
||||
const account = await userService.getCurrent();
|
||||
const passkeys = await webauthnService.listCredentials();
|
||||
const accessToken = cookies.get(ACCESS_TOKEN_COOKIE_NAME);
|
||||
const webauthnService = new WebAuthnService(accessToken);
|
||||
const userService = new UserService(accessToken);
|
||||
|
||||
const [account, passkeys] = await Promise.all([
|
||||
userService.getCurrent(),
|
||||
webauthnService.listCredentials()
|
||||
]);
|
||||
|
||||
return {
|
||||
account,
|
||||
passkeys
|
||||
|
||||
Reference in New Issue
Block a user