diff --git a/frontend/src/hooks.server.ts b/frontend/src/hooks.server.ts index 7c6b94c..c7fdbdd 100644 --- a/frontend/src/hooks.server.ts +++ b/frontend/src/hooks.server.ts @@ -13,8 +13,17 @@ const authorizationHandle: Handle = async ({ event, resolve }) => { const session = await event.locals.auth(); - // Landing page: show for unauthenticated, redirect to workspace for authenticated + // Landing page: only on synops.no (not workspace.synops.no) if (path === '/') { + const host = event.url.hostname; + if (host.startsWith('workspace.')) { + // workspace.synops.no: uautentisert → login, autentisert → workspace + if (!session?.user) { + throw redirect(303, '/auth/signin'); + } + throw redirect(303, '/workspace'); + } + // synops.no: vis landingsside for alle if (session?.user) { throw redirect(303, '/workspace'); }