🐛 fix(auth): Add error handling to form submission and reset Turnstile on failure

This commit is contained in:
web@ppanel
2025-02-23 13:12:25 +07:00
parent 0f15fb82cb
commit 715d0113ca
10 changed files with 108 additions and 43 deletions
+5 -2
View File
@@ -40,8 +40,11 @@ export default function LoginForm({
const turnstile = useRef<TurnstileRef>(null);
const handleSubmit = form.handleSubmit((data) => {
onSubmit(data);
turnstile.current?.reset();
try {
onSubmit(data);
} catch (error) {
turnstile.current?.reset();
}
});
return (
+5 -2
View File
@@ -78,8 +78,11 @@ export default function RegisterForm({
const turnstile = useRef<TurnstileRef>(null);
const handleSubmit = form.handleSubmit((data) => {
onSubmit(data);
turnstile.current?.reset();
try {
onSubmit(data);
} catch (error) {
turnstile.current?.reset();
}
});
return (
+5 -2
View File
@@ -45,8 +45,11 @@ export default function ResetForm({
const turnstile = useRef<TurnstileRef>(null);
const handleSubmit = form.handleSubmit((data) => {
onSubmit(data);
turnstile.current?.reset();
try {
onSubmit(data);
} catch (error) {
turnstile.current?.reset();
}
});
return (