From 41b5eff5b647a77f06bb61aab718b8003565d698 Mon Sep 17 00:00:00 2001 From: MarcEricMartel <74071476+MarcEricMartel@users.noreply.github.com> Date: Sun, 30 Oct 2022 15:14:50 -0700 Subject: [PATCH] Kenny Login - Highway to the Danger Zone --- .../grosses-mitaines-ui/src/components/App.js | 3 +- .../src/components/Topbar.js | 3 ++ .../grosses-mitaines-ui/src/pages/Login.js | 49 +++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/App.js b/GrossesMitaines/grosses-mitaines-ui/src/components/App.js index c6b05d1..8cf5038 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/App.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/App.js @@ -7,9 +7,9 @@ import ContactUs from "../pages/ContactUs"; import Morceaux from "../pages/Morceaux"; import MorceauDetail from "../pages/MorceauDetail"; import Inventaire from "../pages/Inventaire"; +import Login from "../pages/Login"; const App = () => { - return ( @@ -21,6 +21,7 @@ const App = () => { }/> }/> }/> + }/> diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/Topbar.js b/GrossesMitaines/grosses-mitaines-ui/src/components/Topbar.js index 6813df2..ea5a31d 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/Topbar.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/Topbar.js @@ -31,6 +31,9 @@ const Topbar = () => { Vie privée + + Connexion + Gestion diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js new file mode 100644 index 0000000..a42c16a --- /dev/null +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js @@ -0,0 +1,49 @@ +import { useState } from "react"; +import { Button } from "react-bootstrap"; + +const Login = () => { + + const [username, setUsername] = useState(""); + const [password, setPassword] = useState(""); + + 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 }) + }) + + // Partie de display d'erreur ou de redirection (faudrait checker pour se faire un state de connexion). + + } + + return ( +
+
+

Connexion

+
+ + setUsername(e.target.value)} /> +
+
+ + setPassword(e.target.value)} /> +
+ +
+
+ ) +} + +export default Login; \ No newline at end of file