From 88da9c53be7858f77c0fb4092e70d9d7636be451 Mon Sep 17 00:00:00 2001
From: redarkyan <romain.ninot@student-cs.fr>
Date: Sun, 24 May 2020 19:24:30 +0200
Subject: [PATCH] start

---
 src/components/Board.js |  7 ++++++-
 src/components/Login.js | 23 +++++++++++++++++++++--
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/components/Board.js b/src/components/Board.js
index 1d06ee1..c698e4d 100644
--- a/src/components/Board.js
+++ b/src/components/Board.js
@@ -17,7 +17,11 @@ const getMessagesList = async (board) => {
 
 // Gets the list of users
 const getUserList = async () => {
-
+    axios.get(API_URL+'/users' , { 
+        responseType : 'json'
+    }).then( response => {
+        this.setState({ tableData: response.data })
+    })
 };
 
 // Gets the data from a board
@@ -30,6 +34,7 @@ const Board = (props) => {
 
     return (
         <div>
+            <h3>A board will be there soon</h3>
         </div>
     );
 };
diff --git a/src/components/Login.js b/src/components/Login.js
index d6d4941..dc54c02 100644
--- a/src/components/Login.js
+++ b/src/components/Login.js
@@ -7,12 +7,30 @@ const API_URL = 'http://138.195.142.10';
 
 // Attempts to login and if successful stores the userId in localStorage and redirects to the boards list
 const handleLogin = async (username, password) => {
-
+    const requestOptions = {
+        method : 'POST',
+        body : JSON.stringify({ 
+            "username" : username,
+            "password" : password,
+        }),
+    }
+    fetch(API_URL+'/login', requestOptions)
+        .then(response => response.json())
+        .then(data => this.setState({ postID:data.id })) 
 };
 
 // Attempts to register and if successful stores the userId in localStorage and redirects to the boards list
 const handleRegister = async (username, password) => {
-
+    const requestOptions = {
+        method : 'POST',
+        body : JSON.stringify({ 
+            "username" : username,
+            "password" : password,
+        }),
+    }
+    fetch(API_URL+'/users', requestOptions)
+        .then(response => response.json())
+        .then(data => this.setState({ postID:data.id }))
 };
 
 const Login = () => {
@@ -20,6 +38,7 @@ const Login = () => {
 
     return (
         <div>
+            <h3>Hello There</h3>
         </div>
     );
 };
-- 
GitLab