From aaaba0ddf3cd3b6b78c85408dcb3c5005a3b90e2 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Wed, 6 Mar 2024 14:08:39 +0100 Subject: [PATCH] User api first draft finished --- frontend/src/rest/Users.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/frontend/src/rest/Users.js b/frontend/src/rest/Users.js index 1bc2884..9ca59a1 100644 --- a/frontend/src/rest/Users.js +++ b/frontend/src/rest/Users.js @@ -8,3 +8,21 @@ export async function register(user, pass, mail){ return restPost("/user", {name: user, password: pass, mail: mail}); restPost("/login", {login: user, password: pass, expiration: exp}) } + +/** + * get informations on a specific user. + * Leaving the id empty will return the user's value based on his token + * if the user is not authenticated. then an empty array should be returned + */ +export async function getUser(id){ + const endpoint = "/user" + id != null ? "/" + id : ""; + return restGet(endpoint); +} + +/** + * Reserved for secretary roles. Allow to list all user on the plateform + */ +export async function getAllUsers(){ + return restGet("/users"); +} +