diff --git a/src/app/components/home/ModalSubmit.tsx b/src/app/components/home/ModalSubmit.tsx index eac359b..d3d7258 100644 --- a/src/app/components/home/ModalSubmit.tsx +++ b/src/app/components/home/ModalSubmit.tsx @@ -66,12 +66,6 @@ const ModalSubmit = ({ // This is a client component so we can access the session directly const session = useSession(); - if (!session.data) { - // The user is not logged in, redirect them to sign in - router.push("/"); - return null; - } - const { mutate, isLoading } = useMutation(createPortfolio, { onSuccess: (data) => { router.push(`/portfolio/${data.id}`); @@ -82,6 +76,12 @@ const ModalSubmit = ({ }, }); + if (!session.data) { + // The user is not logged in, redirect them to sign in + router.push("/"); + return null; + } + const handleSubmit = () => { const userId = session.data.user.dbId; const status = "scoping";