diff --git a/frontend/src/pages/Connection.jsx b/frontend/src/pages/Connection.jsx index 13e4c50..94e2907 100644 --- a/frontend/src/pages/Connection.jsx +++ b/frontend/src/pages/Connection.jsx @@ -95,3 +95,5 @@ function Connection() { } export default Connection; + + diff --git a/frontend/src/pages/Inscription.jsx b/frontend/src/pages/Inscription.jsx index 57d010b..b434153 100644 --- a/frontend/src/pages/Inscription.jsx +++ b/frontend/src/pages/Inscription.jsx @@ -1,4 +1,5 @@ import React, { useState } from "react"; +import { NavLink } from "react-router-dom"; import axios from "axios"; import LogoContainer from "../components/LogoContainer"; @@ -11,8 +12,14 @@ function Inscription() { civility: "", naissance: "", }); - const [error, setError] = useState(false); - const [succes, setSucces] = useState(false); + + // const { updateUser, user: connectedUser } = useUser(); + const [showModal, setShowModal] = useState(false); + // const navigate = useNavigate(); + + const toggleModal = () => { + setShowModal(!showModal); + }; const handleInputChange = (e) => { const { name, value } = e.target; @@ -33,22 +40,19 @@ function Inscription() { const result = await axios.post("http://localhost:3310/api/users", user); // console.log(user); if (result.status === 201) { - setSucces(true); - } else { - setError(true); + toggleModal(); // Afficher la modale en cas de succès + // updateUser(result.data); + // navigate("/"); } // console.log("Request URL:", url); // console.log("User registered successfully"); } catch (someError) { - setError(true); console.error("Error during registration:", someError); } }; return (
Votre inscription a été effectuée avec succès
+ + +