diff --git a/src/app/(account)/forgot-password/page.tsx b/src/app/(account)/forgot-password/page.tsx index 8add8171..48f7ee82 100644 --- a/src/app/(account)/forgot-password/page.tsx +++ b/src/app/(account)/forgot-password/page.tsx @@ -45,8 +45,14 @@ export default function ForgotPasswordPage() { resolver: zodResolver(resetPasswordSchema), }); + const [sendCodeLoading, setSendCodeLoading] = useState(false); + const [resetPasswordLoading, setResetPasswordLoading] = useState(false); + const handleSendCode = sendCodeForm.handleSubmit(async ({ email }) => { if (!isLoaded) return; + + setSendCodeLoading(true); + try { const result = await signIn.create({ strategy: 'reset_password_email_code', @@ -70,10 +76,15 @@ export default function ForgotPasswordPage() { }, ]); } + + setSendCodeLoading(false); }); const handleResetPassword = resetPasswordForm.handleSubmit(async ({ code, password }) => { if (!isLoaded) return; + + setResetPasswordLoading(true); + try { const resetResult = await signIn.attemptFirstFactor({ strategy: 'reset_password_email_code', @@ -105,6 +116,8 @@ export default function ForgotPasswordPage() { }, ]); } + + setResetPasswordLoading(false); }); return ( @@ -120,7 +133,12 @@ export default function ForgotPasswordPage() { control={sendCodeForm.control} name="email" /> - @@ -145,7 +163,12 @@ export default function ForgotPasswordPage() { control={resetPasswordForm.control} name="code" /> - diff --git a/src/app/(account)/join/steps/StepOne.tsx b/src/app/(account)/join/steps/StepOne.tsx index 3b01b4f6..9d13d0fe 100644 --- a/src/app/(account)/join/steps/StepOne.tsx +++ b/src/app/(account)/join/steps/StepOne.tsx @@ -31,8 +31,13 @@ function VerifyEmail() { const { isLoaded, signUp, setActive } = useSignUp(); + const [verifyEmailLoading, setVerifyEmailLoading] = useState(false); + const handleVerify = form.handleSubmit(async ({ code }) => { if (!isLoaded) return; + + setVerifyEmailLoading(true); + try { const completeSignUp = await signUp.attemptEmailAddressVerification({ code, @@ -53,13 +58,20 @@ function VerifyEmail() { }, ]); } + + setVerifyEmailLoading(false); }); return (
- @@ -88,8 +100,13 @@ export default function StepOne() { const { signUp, isLoaded } = useSignUp(); const [pendingVerification, setPendingVerification] = useState(false); + const [emailJoinLoading, setEmailJoinLoading] = useState(false); + const handleSignUp = form.handleSubmit(async (formData) => { if (!isLoaded) return; + + setEmailJoinLoading(true); + try { await signUp.create(formData); await signUp.prepareEmailAddressVerification({ strategy: 'email_code' }); @@ -111,6 +128,8 @@ export default function StepOne() { }, ]); } + + setEmailJoinLoading(false); }); const handleGoogleSignUp = async () => { @@ -152,7 +171,12 @@ export default function StepOne() { name="password" />
-
diff --git a/src/app/(account)/signin/page.tsx b/src/app/(account)/signin/page.tsx index fb111125..cfe5d786 100644 --- a/src/app/(account)/signin/page.tsx +++ b/src/app/(account)/signin/page.tsx @@ -6,6 +6,7 @@ import FancyRectangle from '@/components/FancyRectangle'; import { useSignIn } from '@clerk/clerk-react'; import { zodResolver } from '@hookform/resolvers/zod'; import Link from 'next/link'; +import { useState } from 'react'; import { useForm } from 'react-hook-form'; import { FcGoogle } from 'react-icons/fc'; import { z } from 'zod'; @@ -25,8 +26,13 @@ export default function SignInPage() { resolver: zodResolver(signInSchema), }); + const [signInLoading, setSignInLoading] = useState(false); + const handleSignIn = form.handleSubmit(async ({ email, password }) => { if (!isLoaded) return; + + setSignInLoading(true); + try { const result = await signIn.create({ identifier: email, @@ -59,6 +65,8 @@ export default function SignInPage() { }, ]); } + + setSignInLoading(false); }); const handleGoogleSignIn = async () => { @@ -110,7 +118,12 @@ export default function SignInPage() { > Forgot password? -