-
// sign-in/form.tsx
export const SignInForm = () => {
const { revalidate } = useRevalidator();
const { supabaseClient } = useSupabaseContext();
const fetcher = useFetcher();
const signIn = async (): Promise<void> => {
const signInRes = await supabaseClient.auth.signInWithPassword({
email: signInForm.email,
password: signInForm.password,
});
if (signInRes.error) {
return;
}
revalidate();
};
return (
<ValidatedForm validator={signInValidator} method="post" fetcher={fetcher}>
<FormInput name="email" label="Email" />
<FormInput name="password" label="Password" />
<FormSubmitButton />
</ValidatedForm>
);
}; In the above case, when the user clicks on submit, I must call the signUp function on the client. How do I handle this case, if it is even supported? Or should I just stick to |
Beta Was this translation helpful? Give feedback.
Answered by
airjp73
Oct 30, 2023
Replies: 1 comment
-
Hi! You can use return (
<ValidatedForm
validator={signInValidator}
onSubmit={async (validatedData, event) => {
event.preventDefault();
await signIn(validatedData);
}}
>
<FormInput name="email" label="Email" />
<FormInput name="password" label="Password" />
<FormSubmitButton />
</ValidatedForm>
); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
JUNIORCO
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
You can use
onSubmit
as you normally would, but withasync
superpowers.