fix: check user session in banner (#9530)

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
pull/9514/head
Udit Takkar 2023-06-15 14:06:09 +05:30 committed by GitHub
parent 3116d6df1a
commit e513180d7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,5 @@
import { useSession } from "next-auth/react";
import { APP_NAME } from "@calcom/lib/constants"; import { APP_NAME } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc"; import { trpc } from "@calcom/trpc";
@ -11,8 +13,10 @@ function VerifyEmailBanner() {
const { t } = useLocale(); const { t } = useLocale();
const { data, isLoading } = useEmailVerifyCheck(); const { data, isLoading } = useEmailVerifyCheck();
const mutation = trpc.viewer.auth.resendVerifyEmail.useMutation(); 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 ( return (
<> <>