diff --git a/src/app/portal/admin/layout.tsx b/src/app/portal/admin/layout.tsx index e2339cfe..3dc1a74e 100644 --- a/src/app/portal/admin/layout.tsx +++ b/src/app/portal/admin/layout.tsx @@ -9,6 +9,8 @@ export default function Layout({ children }: { children: React.ReactNode }) { if (!user) { redirect("/auth"); } + + if ( !userMetadata || !userMetadata.roles || diff --git a/src/app/portal/layout.tsx b/src/app/portal/layout.tsx index 7698486b..333b471a 100644 --- a/src/app/portal/layout.tsx +++ b/src/app/portal/layout.tsx @@ -25,7 +25,7 @@ async function getUserMetadata(id: string) { }); const [roles, member] = await Promise.all([rolesP, memberP]); return { - roles: roles, + roles: roles?.roles, member: member, }; }