Merge branch 'master' into wal/frontend/Register
This commit is contained in:
35
frontend/src/rest/ServiceInscription.js
Normal file
35
frontend/src/rest/ServiceInscription.js
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* functions to handle register requests.
|
||||
*
|
||||
* TODO: On time of writing, the backend doesn't support these endpoints so it could be modified in the future.
|
||||
*/
|
||||
import { restGet } from './restConsumer.js'
|
||||
|
||||
/**
|
||||
* create a new register requests that can be recovered by the registering service
|
||||
* TODO: add info in the Object (I don't know what will be needed)
|
||||
*/
|
||||
export async function createRegister(){
|
||||
return restPost("/requests/register"});
|
||||
}
|
||||
|
||||
/**
|
||||
* list all register request in a list of Objects
|
||||
*/
|
||||
export async function getRegisters(){
|
||||
return restGet("/requests/register")
|
||||
}
|
||||
|
||||
/**
|
||||
* Get info on a particular registering request
|
||||
*/
|
||||
export async function getRegisters(id){
|
||||
return restGet("/requests/register/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the state of a requests.
|
||||
*/
|
||||
export async function validateRegister(id, state){
|
||||
return restPost("/requests/register/" + id, {state: state});
|
||||
}
|
@ -6,7 +6,6 @@ export async function login(user, pass, exp){
|
||||
|
||||
export async function register(user, pass, mail){
|
||||
return restPost("/user", {name: user, password: pass, mail: mail});
|
||||
restPost("/login", {login: user, password: pass, expiration: exp})
|
||||
}
|
||||
|
||||
/**
|
||||
|
41
frontend/src/rest/cursus.js
Normal file
41
frontend/src/rest/cursus.js
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* cursus API
|
||||
*/
|
||||
|
||||
import { restGet, restPostn, restDelete, restPatch } from './restConsumer.js'
|
||||
|
||||
/**
|
||||
* Create a new cursus (bundle of courses)
|
||||
* @param courses list of courses
|
||||
*/
|
||||
export async function createCursus(courses){
|
||||
return restPost("/cursus", {courses: courses} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the specified cursus
|
||||
*/
|
||||
export async function deleteCursus(id){
|
||||
return restDelete("/cursus/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get informations on a particular cursus
|
||||
*
|
||||
* @param id identification of the cursus
|
||||
*
|
||||
* @return list of courses
|
||||
*/
|
||||
export async function getCursus(id){
|
||||
return restGet("/cursus/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the courses of a cursus
|
||||
*
|
||||
* @param id the id of the cursus
|
||||
* @param courses list of new courses
|
||||
*/
|
||||
export async function alterCursus(id, courses){
|
||||
return restPatch("/cursus/" + id, courses);
|
||||
}
|
Reference in New Issue
Block a user