diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts
index 43fc11e..5372807 100644
--- a/src/routes/+layout.server.ts
+++ b/src/routes/+layout.server.ts
@@ -1,6 +1,7 @@
/** @type {import('./$types').LayoutServerLoad} */
export async function load({ locals }) {
return {
- session: locals.session
+ session: locals.session,
+ user: locals.user
};
}
diff --git a/src/routes/org/[orgid]/+layout.server.ts b/src/routes/org/[orgid]/+layout.server.ts
index 9e18786..b715ed0 100644
--- a/src/routes/org/[orgid]/+layout.server.ts
+++ b/src/routes/org/[orgid]/+layout.server.ts
@@ -1,11 +1,16 @@
import OrganizationsDB, { type OrganizationPayload } from '$database/OrganizationsDB';
+import type { User } from '@supabase/supabase-js';
/** @type {import('./$types').LayoutServerLoad} */
-export async function load({ params, locals }): Promise<{ payload: OrganizationPayload | null }> {
+export async function load({
+ params,
+ locals
+}): Promise<{ payload: OrganizationPayload | null; user: User | null }> {
/** Get the serializable organization payload from the database */
const org = await new OrganizationsDB(locals.supabase).getPayload(params.orgid);
return {
- payload: org
+ payload: org,
+ user: locals.user
};
}
diff --git a/src/routes/org/[orgid]/+layout.svelte b/src/routes/org/[orgid]/+layout.svelte
index c5fdd13..041e8de 100644
--- a/src/routes/org/[orgid]/+layout.svelte
+++ b/src/routes/org/[orgid]/+layout.svelte
@@ -1,20 +1,19 @@
{#if $org}
- {#if $org.getVisibility() === 'public' || ($user && $org.getVisibility() === 'org' && $org.hasPerson($user.id)) || ($user && $org.getVisibility() === 'admin' && $org.hasAdminPerson($user.id))}
+ {#if $org.getVisibility() === 'public' || (user && (($org.getVisibility() === 'org' && $org.hasPerson(user.id)) || ($org.getVisibility() === 'admin' && $org.hasAdminPerson(user.id))))}