diff --git a/src/routes/console/+page.ts b/src/routes/console/+page.ts index 94665aae52..3d2e9512a6 100644 --- a/src/routes/console/+page.ts +++ b/src/routes/console/+page.ts @@ -7,7 +7,9 @@ export const load: PageLoad = async ({ parent, url }) => { if (organizations.total) { const teamId = account.prefs.organization ?? organizations.teams[0].$id; - throw redirect(303, `${base}/console/organization-${teamId}${url.search ?? ''}`); + if (!teamId) { + throw redirect(303, `${base}/console/account/organizations${url.search ?? ''}`); + } else throw redirect(303, `${base}/console/organization-${teamId}${url.search ?? ''}`); } else { throw redirect(303, `${base}/console/onboarding${url.search ?? ''}`); } diff --git a/src/routes/console/organization-[organization]/+layout.ts b/src/routes/console/organization-[organization]/+layout.ts index 16c152cfe9..056bea66cc 100644 --- a/src/routes/console/organization-[organization]/+layout.ts +++ b/src/routes/console/organization-[organization]/+layout.ts @@ -41,7 +41,7 @@ export const load: LayoutLoad = async ({ params, depends }) => { }; } catch (e) { const prefs = await sdk.forConsole.account.getPrefs(); - const newPrefs = { ...prefs, organization: '' }; + const newPrefs = { ...prefs, organization: null }; sdk.forConsole.account.updatePrefs(newPrefs); localStorage.removeItem('organization'); throw error(e.code, e.message);