feat: optimize loading state in login and register forms
This commit is contained in:
parent
9f71c9942a
commit
9f2fd58eb0
@ -95,6 +95,10 @@ export const LoginForm = ({
|
||||
const onSubmit = async (values: z.infer<typeof LoginSchema>) => {
|
||||
// Validate captcha token if turnstile is enabled and site key is available
|
||||
if (captchaConfigured && values.captchaToken) {
|
||||
setIsPending(true);
|
||||
setError('');
|
||||
setSuccess('');
|
||||
|
||||
const captchaResult = await validateCaptchaAction({
|
||||
captchaToken: values.captchaToken,
|
||||
});
|
||||
|
@ -94,6 +94,10 @@ export const RegisterForm = ({
|
||||
const onSubmit = async (values: z.infer<typeof RegisterSchema>) => {
|
||||
// Validate captcha token if turnstile is enabled and site key is available
|
||||
if (captchaConfigured && values.captchaToken) {
|
||||
setIsPending(true);
|
||||
setError('');
|
||||
setSuccess('');
|
||||
|
||||
const captchaResult = await validateCaptchaAction({
|
||||
captchaToken: values.captchaToken,
|
||||
});
|
||||
@ -119,13 +123,13 @@ export const RegisterForm = ({
|
||||
},
|
||||
{
|
||||
onRequest: (ctx) => {
|
||||
console.log('register, request:', ctx.url);
|
||||
// console.log('register, request:', ctx.url);
|
||||
setIsPending(true);
|
||||
setError('');
|
||||
setSuccess('');
|
||||
},
|
||||
onResponse: (ctx) => {
|
||||
console.log('register, response:', ctx.response);
|
||||
// console.log('register, response:', ctx.response);
|
||||
setIsPending(false);
|
||||
},
|
||||
onSuccess: (ctx) => {
|
||||
|
Loading…
Reference in New Issue
Block a user