From be0a557722703ba63993a3f42f7402914684cd05 Mon Sep 17 00:00:00 2001 From: Armin Talaie Date: Fri, 27 Sep 2024 20:05:20 -0700 Subject: [PATCH] auth fix --- src/app/portal/admin/layout.tsx | 2 ++ src/app/portal/layout.tsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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, }; }