From 4deea55663d941a8aa98563358fe03f1ee17af99 Mon Sep 17 00:00:00 2001 From: Jean-Daniel Lamontagne Date: Tue, 1 Nov 2022 08:48:46 -0400 Subject: [PATCH] Register --- .../grosses-mitaines-ui/src/components/App.js | 2 + .../grosses-mitaines-ui/src/pages/Login.js | 3 ++ .../grosses-mitaines-ui/src/pages/Register.js | 49 +++++++++++++++++++ .../src/stylesheets/site.css | 5 ++ 4 files changed, 59 insertions(+) create mode 100644 GrossesMitaines/grosses-mitaines-ui/src/pages/Register.js diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/App.js b/GrossesMitaines/grosses-mitaines-ui/src/components/App.js index 7cf22a0..11de21f 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/App.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/App.js @@ -9,6 +9,7 @@ import MorceauDetail from "../pages/MorceauDetail"; import Inventaire from "../pages/Inventaire"; import Login from "../pages/Login"; import Logout from "../pages/Logout"; +import Register from "../pages/Register"; const App = () => { return ( @@ -23,6 +24,7 @@ const App = () => { }/> }/> }/> + }/> diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js index a42c16a..09a19cc 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Login.js @@ -41,6 +41,9 @@ const Login = () => { onChange={(e) => setPassword(e.target.value)} /> + ) diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Register.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Register.js new file mode 100644 index 0000000..08092b4 --- /dev/null +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Register.js @@ -0,0 +1,49 @@ +import { useState } from "react"; +import { Button } from "react-bootstrap"; + +const Register = () => { + + 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 ( +
+
+

Nouvel utilisateur

+
+ + setUsername(e.target.value)} /> +
+
+ + setPassword(e.target.value)} /> +
+ +
+
+ ) +} + +export default Register; \ 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 30c2e38..6f5ffc9 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/stylesheets/site.css +++ b/GrossesMitaines/grosses-mitaines-ui/src/stylesheets/site.css @@ -15,6 +15,11 @@ html { height: 100%; } +a { + color: white; + text-decoration: none; +} + .contactUs { height: 100vh; }