diff --git a/src/apis/back.ts b/src/apis/back.ts index 0932f46a6e45826c6d09f640faa6a0feb10b3206..578adbb24004cec9c955afe30a50587ef879788a 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 0783b8ba1c6a16f7c6d406992721b6efbda879fc..566880dfaf94bb6f3cc22a3bbf43e92be91c7289 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 27e1a7e30ef3b06914cec36c6c079bc6ca816576..5d11e95858bb94b5839b852f551329c1d5e366f5 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