diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js index 8b2a00e..95a178b 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js @@ -1,5 +1,6 @@ import { useState } from "react"; import { Button } from "react-bootstrap"; +import { useNavigate } from "react-router-dom"; const Login = () => { const [rememberme, setPersistence] = useState(true); @@ -7,6 +8,8 @@ const Login = () => { const [password, setPassword] = useState(""); const [returnmess, returnMessage] = useState(""); + const navigate = useNavigate(); + const handleLogin = async (e) => { e.preventDefault(); @@ -31,9 +34,7 @@ const Login = () => { 'Content-Type': 'text/json' } }); - // TODO: Redirection vers Home et ajout du cookie pour React pour le layout. - console.log(await confirm.json()) - returnMessage("WOOHOO!"); + navigate("/"); } else returnMessage("L'adresse courriel ou le mot de passe est incorrect."); } @@ -64,9 +65,6 @@ const Login = () => { onChange={(e) => setPassword(e.target.value)} /> - ) diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Logout.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Logout.js index ca507b5..94298f2 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/pages/Logout.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Logout.js @@ -2,6 +2,7 @@ const Logout = () => { const response = fetch(`https://localhost:7292/api/Logout`, { method: 'POST', + credentials: 'include' }) return (