From f8197157b6f33771226756dd9e332a2a9dced001 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?LAFOR=C3=8AT=20Nicolas?= <nlaforet@etu.unistra.fr>
Date: Fri, 17 Dec 2021 12:12:17 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=A1=20added=20students=20mocks?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/apis/back.ts    |  1 +
 src/apis/mocks.ts   | 35 +++++++++++++++++++++++++++++------
 src/apis/student.ts |  4 +++-
 3 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/src/apis/back.ts b/src/apis/back.ts
index 0932f46..578adbb 100644
--- a/src/apis/back.ts
+++ b/src/apis/back.ts
@@ -1,4 +1,5 @@
 import axios from 'axios';
+
 import { Product } from '../cart/CartTypes';
 import { mockedStocks } from './mocks';
 
diff --git a/src/apis/mocks.ts b/src/apis/mocks.ts
index 0783b8b..566880d 100644
--- a/src/apis/mocks.ts
+++ b/src/apis/mocks.ts
@@ -6,7 +6,7 @@ export const mockedStocks: any[] = [
       price: 0.5,
       subscriber_price: 0.5,
       category: {
-        name: "Boisson"
+        name: "Boissons"
       }
     }
   },
@@ -17,7 +17,7 @@ export const mockedStocks: any[] = [
       price: 0.5,
       subscriber_price: 0.5,
       category: {
-        name: "Boisson"
+        name: "Boissons"
       }
     }
   },
@@ -28,7 +28,7 @@ export const mockedStocks: any[] = [
       price: 0.5,
       subscriber_price: 0.5,
       category: {
-        name: "Boisson"
+        name: "Boissons"
       }
     }
   },
@@ -39,7 +39,7 @@ export const mockedStocks: any[] = [
       price: 0.6,
       subscriber_price: 0.6,
       category: {
-        name: "Snack"
+        name: "Snacks"
       }
     }
   },
@@ -50,7 +50,7 @@ export const mockedStocks: any[] = [
       price: 0.3,
       subscriber_price: 0.3,
       category: {
-        name: "Snack"
+        name: "Snacks"
       }
     }
   },
@@ -61,7 +61,7 @@ export const mockedStocks: any[] = [
       price: 0.5,
       subscriber_price: 0.5,
       category: {
-        name: "Snack"
+        name: "Snacks"
       }
     }
   },
@@ -77,3 +77,26 @@ export const mockedStocks: any[] = [
     }
   },
 ];
+
+export const mockedUsers: any[] = [
+  {
+    "student_number": 12345678,
+    "username": "12345678",
+    "lastname": "Princelle",
+    "firstname": "Maxime",
+    "email": "princelle@etu.unistra.fr",
+    "date_subscription": null,
+    "picture": "https://cdn.pixabay.com/photo/2018/09/06/18/26/person-3658927_960_720.png",
+    "date_birth": "1999-06-05",
+  },
+  {
+    "student_number": 87654321,
+    "username": "Test User",
+    "lastname": "Test",
+    "firstname": "User",
+    "email": "test@test.test",
+    "date_subscription": "2021-01-01",
+    "picture": "https://cdn.pixabay.com/photo/2018/09/06/18/26/person-3658927_960_720.png",
+    "date_birth": "2000-01-01",
+  },
+];
diff --git a/src/apis/student.ts b/src/apis/student.ts
index 27e1a7e..5d11e95 100644
--- a/src/apis/student.ts
+++ b/src/apis/student.ts
@@ -1,5 +1,7 @@
 import axios from 'axios';
 
+import { mockedUsers } from './mocks';
+
 export class User {
   nom: string;
   prenom: string;
@@ -30,7 +32,7 @@ export async function getUsers(): Promise<User[]> {
   }).then(({ data }) => data)
     .catch(error => {
       console.error(error);
-      return [];
+      return mockedUsers;
     });
 
   // Format users data
-- 
GitLab