diff --git a/src/routes/database/+layout.server.ts b/src/routes/database/+layout.server.ts index b12e8629..afba17c3 100644 --- a/src/routes/database/+layout.server.ts +++ b/src/routes/database/+layout.server.ts @@ -2,20 +2,20 @@ import { redirect } from '@sveltejs/kit' import type { LayoutServerLoad } from './$types' export const load: LayoutServerLoad = async ({ locals, url }) => { - // Check authentication first - if (!locals.session.isAuthenticated) { - throw redirect(302, '/login') - } + // Check authentication first + if (!locals.session.isAuthenticated) { + throw redirect(302, '/login') + } - // Check role authorization - const role = locals.session.account?.role ?? 0 - if (role < 7) { - // Redirect to home with no indication of why (security best practice) - throw redirect(302, '/') - } + // Check role authorization + const role = locals.session.account?.role ?? 0 + if (role < 7) { + // Redirect to home with no indication of why (security best practice) + throw redirect(302, '/') + } - return { - role - } + return { + role, + user: locals.session.user + } } - diff --git a/src/routes/database/+layout.svelte b/src/routes/database/+layout.svelte index 161ba2bd..da54141d 100644 --- a/src/routes/database/+layout.svelte +++ b/src/routes/database/+layout.svelte @@ -1,59 +1,30 @@ -
- -
- - +{@render children?.()} -