fix: check user session in banner (#9530)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>pull/9514/head
parent
3116d6df1a
commit
e513180d7e
|
@ -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 (
|
||||||
<>
|
<>
|
||||||
|
|
Loading…
Reference in New Issue