1
0
forked from PGL/Clyde

User api first draft finished

This commit is contained in:
Debucquoy Anthony 2024-03-06 14:08:39 +01:00
parent e158fa1f87
commit aaaba0ddf3
Signed by: tonitch
GPG Key ID: A78D6421F083D42E

View File

@ -8,3 +8,21 @@ export async function register(user, pass, mail){
return restPost("/user", {name: user, password: pass, mail: mail}); return restPost("/user", {name: user, password: pass, mail: mail});
restPost("/login", {login: user, password: pass, expiration: exp}) 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");
}