mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
🎨
This commit is contained in:
@ -14,12 +14,12 @@ type FormValues = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function Signup(props: { source: string }) {
|
export default function Signup(props: { source: string }) {
|
||||||
const methods = useForm<FormValues>({});
|
const form = useForm<FormValues>({});
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
trigger,
|
trigger,
|
||||||
formState: { errors, isSubmitting },
|
formState: { errors, isSubmitting },
|
||||||
} = methods;
|
} = form;
|
||||||
|
|
||||||
const handleErrors = async (resp: Response) => {
|
const handleErrors = async (resp: Response) => {
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
@ -52,7 +52,7 @@ export default function Signup(props: { source: string }) {
|
|||||||
)
|
)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
toast.dismiss();
|
toast.dismiss();
|
||||||
methods.setError("apiError", { message: err.message });
|
form.setError("apiError", { message: err.message });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -123,11 +123,11 @@ export default function Signup(props: { source: string }) {
|
|||||||
</div>
|
</div>
|
||||||
{renderApiError()}
|
{renderApiError()}
|
||||||
{renderFormValidation()}
|
{renderFormValidation()}
|
||||||
<FormProvider {...methods}>
|
<FormProvider {...form}>
|
||||||
<form
|
<form
|
||||||
onSubmit={methods.handleSubmit(signUp)}
|
onSubmit={form.handleSubmit(signUp)}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
methods.clearErrors();
|
form.clearErrors();
|
||||||
trigger();
|
trigger();
|
||||||
}}
|
}}
|
||||||
className="mt-8 space-y-6"
|
className="mt-8 space-y-6"
|
||||||
@ -175,7 +175,7 @@ export default function Signup(props: { source: string }) {
|
|||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
methods.clearErrors();
|
form.clearErrors();
|
||||||
}}
|
}}
|
||||||
className="sgroup relative flex w-full"
|
className="sgroup relative flex w-full"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user