diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Register.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Register.js index 6443b8c..160d10a 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/pages/Register.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Register.js @@ -1,70 +1,86 @@ import { useState } from "react"; import { Button } from "react-bootstrap"; +import { useForm } from "react-hook-form"; -const Register = () => { +// const Register = () => { - //const [username, setUsername] = useState(""); - //const [password, setPassword] = useState(""); +// //const [username, setUsername] = useState(""); +// //const [password, setPassword] = useState(""); - const handleLogin = async (e) => { - e.preventDefault(); +// // const handleLogin = async (e) => { +// // e.preventDefault(); - const response = await fetch(`https://localhost:7292/api/Login?rememberme=true`, { - method: 'POST', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - //body: JSON.stringify({ username, password }) - }) +// // const response = await fetch(`https://localhost:7292/api/Login?rememberme=true`, { +// // method: 'POST', +// // headers: { +// // 'Accept': 'application/json', +// // 'Content-Type': 'application/json' +// // }, +// // //body: JSON.stringify({ username, password }) +// // }) - // Partie de display d'erreur ou de redirection (faudrait checker pour se faire un state de connexion). +// // Partie de display d'erreur ou de redirection (faudrait checker pour se faire un state de connexion). - } +// } - return ( +export default function App() { + const { register, handleSubmit, watch, formState: { errors } } = useForm(); + const onSubmit = data => console.log(data); +return (
-
+

Nouvel utilisateur

+
- + +
+
+ {errors.Prénom && errors.Prénom.type === 'required' && Vous devez entrer votre prénom!} + {errors.Prénom && errors.Prénom.type === 'minLength' && Votre prénom doit avoir au moins 2 lettres!}
- + +
+
+ {errors.Nom && errors.Nom.type === 'required' && Vous devez entrer votre nom!} + {errors.Nom && errors.Nom.type === 'minLength' && Votre nom doit avoir au moins 2 lettres!}
- +
+ {errors.Téléphone && errors.Téléphone.type === 'required' && Vous devez entrer un numéro de téléphone!} + {errors.Téléphone && errors.Téléphone.type === 'pattern' && Téléphone non valide!}
- +
+ {errors.Adresse && errors.Adresse.type === 'required' && Vous devez entrer une adresse!}
- + +
+
+ {errors.Email && errors.Email.type === 'required' && Vous devez entrer une adresse courriel!} + {errors.Email && errors.Email.type === 'pattern' && Adresse courriel non valide!}
- + +
+
+ {errors.MotPasse && errors.MotPasse.type === 'required' && Vous devez entrer un mot de passe!} + {errors.MotPasse && errors.MotPasse.type === 'minLength' && Votre mot de passe doit avoir au moins 5 caractères!}
- + +
) -} - -export default Register; \ No newline at end of file +} \ No newline at end of file diff --git a/GrossesMitaines/grosses-mitaines-ui/src/stylesheets/site.css b/GrossesMitaines/grosses-mitaines-ui/src/stylesheets/site.css index 4aba815..9db1879 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/stylesheets/site.css +++ b/GrossesMitaines/grosses-mitaines-ui/src/stylesheets/site.css @@ -634,6 +634,10 @@ a { margin-bottom: 10px; } +.form-group input { + width: 100%; +} + .simple-item-top-container { display: flex; }