diff --git a/packages/web/src/components/SignUpForm/index.ee.tsx b/packages/web/src/components/SignUpForm/index.ee.tsx index d3ecfd6d..1f95ee08 100644 --- a/packages/web/src/components/SignUpForm/index.ee.tsx +++ b/packages/web/src/components/SignUpForm/index.ee.tsx @@ -4,55 +4,31 @@ import { useMutation } from '@apollo/client'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import LoadingButton from '@mui/lab/LoadingButton'; +import * as yup from 'yup'; import useAuthentication from 'hooks/useAuthentication'; import * as URLS from 'config/urls'; import { LOGIN } from 'graphql/mutations/login'; import Form from 'components/Form'; import TextField from 'components/TextField'; +import { yupResolver } from '@hookform/resolvers/yup'; -function renderFields(props: { loading: boolean }) { - const { loading = false } = props; +const validationSchema = yup.object().shape({ + fullName: yup.string().required(), + email: yup.string().email().required(), + password: yup.string().required(), + confirmPassword: yup + .string() + .required() + .oneOf([yup.ref('password')], 'Passwords must match'), +}); - return () => { - return ( - <> - - - - - - Login - - - ); - }; -} +const initialValue = { + fullName: '', + email: '', + password: '', + confirmPassword: '', +}; function SignUpForm() { const navigate = useNavigate(); @@ -77,7 +53,7 @@ function SignUpForm() { authentication.updateToken(token); }; - const render = React.useMemo(() => renderFields({ loading }), [loading]); + //const render = React.useMemo(() => renderFields({ loading }), [loading]); return ( @@ -92,10 +68,72 @@ function SignUpForm() { }} gutterBottom > - Login + Sign Up -
+ ( + <> + + + + + + + + + + Sign Up + + + )} + /> ); }