From 054e1c6da06f10201ce9a50119fdfa9e40bcf7f7 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 7 Dec 2024 19:06:24 +0100 Subject: [PATCH] Display a message after successful submission of registration form --- app/ui/components/registration-form.tsx | 101 +++++++++++++----------- 1 file changed, 55 insertions(+), 46 deletions(-) diff --git a/app/ui/components/registration-form.tsx b/app/ui/components/registration-form.tsx index 5c4fb71..3c7b5d7 100644 --- a/app/ui/components/registration-form.tsx +++ b/app/ui/components/registration-form.tsx @@ -11,6 +11,7 @@ import { register } from '@/app/api/authentication'; import { getCaptchaChallenge } from '@/app/api/captcha'; export default function RegistrationForm() { + const [submitted, setSubmitted] = useState(false); const [errors, setErrors] = useState([]); const [email, setEmail] = useState(""); @@ -36,54 +37,62 @@ export default function RegistrationForm() { useEffect(refreshCaptcha, []) return ( -
- - setEmail(e.target.value)} /> - - - - setPassword(e.target.value)} /> - - - - setPasswordConfirmation(e.target.value)} /> - - - - setSlug(e.target.value)} /> - - - captcha - - setCaptchaAnswer(e.target.value)} /> - - + submitted ? ( +
+
Registration successful. Check your email for a confirmation link.
+
+ ) : ( - {errors.map((error, index) => ( -
{error}
- ))} +
+ + setEmail(e.target.value)} /> + + + + setPassword(e.target.value)} /> + + + + setPasswordConfirmation(e.target.value)} /> + + + + setSlug(e.target.value)} /> + + + captcha + + setCaptchaAnswer(e.target.value)} /> + + + + {errors.map((error, index) => ( +
{error}
+ ))} - -
+ +
+ ) + ); } \ No newline at end of file