From 9fe5adab7016a6a25ef1361666dd17639e0cd707 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 25 Nov 2022 13:09:10 +0100 Subject: [PATCH] fix: account fetch waterfall --- src/routes/+layout.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 4544b5beb..84e164569 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -8,9 +8,6 @@ import type { LayoutLoad } from './$types'; export const ssr = false; export const load: LayoutLoad = async ({ depends, url }) => { - if (url.pathname.startsWith('/auth')) { - return; - } depends(Dependencies.ACCOUNT); try { const account = await sdkForConsole.account.get(); @@ -20,7 +17,15 @@ export const load: LayoutLoad = async ({ depends, url }) => { organizations: sdkForConsole.teams.list() }; } catch (error) { - const acceptedRoutes = ['/login', '/register', '/recover', '/invite']; + const acceptedRoutes = [ + '/login', + '/register', + '/recover', + '/invite', + '/auth/magic-url', + '/auth/oauth2/success', + '/auth/oauth2/failure' + ]; if (!acceptedRoutes.includes(url.pathname)) { throw redirect(303, '/login');