From 782f7f3c8cb23e33b53e9e4780103f5368504dd8 Mon Sep 17 00:00:00 2001 From: Priyanshu Verma Date: Thu, 3 Oct 2024 14:01:39 +0000 Subject: [PATCH] redirection fix --- src/app/layout.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index b5c68ad..cd6e1f7 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -52,9 +52,11 @@ export default async function RootLayout({ const h = headers(); const pathname = h.get("x-current-path"); - if (!session?.user.emailVerified) { - if (!pathname!.includes("/auth")) { - redirect("/auth/verify"); + if (session) { + if (!session.user.emailVerified) { + if (!pathname!.includes("/auth")) { + redirect("/auth/verify"); + } } }