From e513180d7e2f34e0bfcbb6d19b7f8fdb31b57ef1 Mon Sep 17 00:00:00 2001 From: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Date: Thu, 15 Jun 2023 14:06:09 +0530 Subject: [PATCH] fix: check user session in banner (#9530) Signed-off-by: Udit Takkar --- packages/features/users/components/VerifyEmailBanner.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/features/users/components/VerifyEmailBanner.tsx b/packages/features/users/components/VerifyEmailBanner.tsx index 1e07efc398..b909755ddf 100644 --- a/packages/features/users/components/VerifyEmailBanner.tsx +++ b/packages/features/users/components/VerifyEmailBanner.tsx @@ -1,3 +1,5 @@ +import { useSession } from "next-auth/react"; + import { APP_NAME } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc"; @@ -11,8 +13,10 @@ function VerifyEmailBanner() { const { t } = useLocale(); const { data, isLoading } = useEmailVerifyCheck(); const mutation = trpc.viewer.auth.resendVerifyEmail.useMutation(); + const session = useSession(); + const isLoggedIn = session?.data?.user; - if (isLoading || data?.isVerified || !flags["email-verification"]) return null; + if (!isLoggedIn || isLoading || data?.isVerified || !flags["email-verification"]) return null; return ( <>