diff --git a/apps/nextjs/src/app/sign-in/[[...sign-in]]/page.tsx b/apps/nextjs/src/app/sign-in/[[...sign-in]]/page.tsx index 05389f4dc..1fec6cab2 100644 --- a/apps/nextjs/src/app/sign-in/[[...sign-in]]/page.tsx +++ b/apps/nextjs/src/app/sign-in/[[...sign-in]]/page.tsx @@ -1,4 +1,9 @@ -import { SignIn } from "@clerk/nextjs"; +"use client"; + +import { useEffect } from "react"; + +import { SignIn, SignedIn, SignedOut, useUser } from "@clerk/nextjs"; +import { useRouter } from "next/navigation"; import SignUpSignInLayout from "@/components/SignUpSignInLayout"; @@ -8,7 +13,12 @@ const SignInPage = () => { return ( <> - + + + + + + @@ -16,4 +26,15 @@ const SignInPage = () => { ); }; +const RedirectToHome = () => { + const { user, isLoaded } = useUser(); + const router = useRouter(); + useEffect(() => { + if (user && isLoaded) { + router.push("/"); + } + }, [router, user, isLoaded]); + return null; +}; + export default SignInPage;