Skip to content

Commit

Permalink
fixes#12966
Browse files Browse the repository at this point in the history
  • Loading branch information
WongChoice committed Dec 30, 2023
1 parent 7579417 commit 1f81e82
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions apps/web/pages/auth/verify-email.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MailOpenIcon } from "lucide-react";
import { useSession } from "next-auth/react";
import { useRouter } from "next/navigation";
import { useEffect } from "react";
import { useEffect, useState } from "react";

import { APP_NAME } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
Expand All @@ -17,13 +17,38 @@ function VerifyEmailPage() {
const router = useRouter();
const { t } = useLocale();
const mutation = trpc.viewer.auth.resendVerifyEmail.useMutation();
const [isContentLoaded, setIsContentLoaded] = useState(false);

useEffect(() => {
if (data?.isVerified) {
router.replace("/getting-started");
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data?.isVerified]);
}, [data?.isVerified, router]);

useEffect(() => {
const checkContent = async () => {
// making sure their value is not the default
const verifyEmailPageBody = await t("verify_email_page_body", {
email: session?.user?.email,
appName: APP_NAME,
});

if (verifyEmailPageBody !== "verify_email_page_body") {
setIsContentLoaded(true);
}
};

checkContent();
}, [t, session?.user?.email]);

if (!isContentLoaded) {
return (
<div className="flex h-full w-full items-center justify-center">
{/* You can render a loading indicator here */}
</div>
);
}


return (

Check failure on line 53 in apps/web/pages/auth/verify-email.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

apps/web/pages/auth/verify-email.tsx#L52-L53

[prettier/prettier] Delete `⏎`
<div className="h-[100vh] w-full ">
Expand Down

0 comments on commit 1f81e82

Please sign in to comment.