Skip to content

Commit

Permalink
update signup page
Browse files Browse the repository at this point in the history
  • Loading branch information
rafa-lopes-pt committed Jul 9, 2024
1 parent e6c7c53 commit cdfbf00
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frontend/src/pages/auth/SignupForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,29 @@ import {
} from "../../../../shared/schemas/signup.schema";
import Button from "../../components/buttons/Button";
import { Form } from "../../components/form/Form";
import { useContext } from "react";
import { AuthCtx, AuthCtxProperties } from "../../store/auth.context";
export default function SignupForm({
onChangeScreen,
animationProps,
}: {
onChangeScreen: Function;
animationProps: any;
}) {
const { signup } = useContext(AuthCtx) as AuthCtxProperties
const { register, handleSubmit, formState } = useForm<SignupSchemaType>({
resolver: zodResolver(SignupSchema),
});

const onSubmitHandler = async (data: SignupSchemaType) => {
if (await signup(data))
onChangeScreen()
}

return (
<Form
animationProps={animationProps}
onSubmit={handleSubmit((data) => console.log(data))}
onSubmit={handleSubmit(onSubmitHandler)}
honeyPotFieldName="username"
>
<Form.Header title="Register">
Expand Down

0 comments on commit cdfbf00

Please sign in to comment.