mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
adapt api endpoint, resolve id parameter passed in api functions
This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
const
|
||||
locale = 'fr',
|
||||
format = 'json'
|
||||
, accompanying_period_id = window.accompanyingCourseId //tmp
|
||||
;
|
||||
|
||||
/*
|
||||
* Endpoint chill_person_accompanying_course_api_show
|
||||
* method GET, get AccompanyingCourse Object
|
||||
* Endpoint v.2 chill_api_single_accompanying_course__entity
|
||||
* method GET/HEAD, get AccompanyingCourse Instance
|
||||
*
|
||||
* @accompanying_period_id___ integer
|
||||
* @TODO var is not used but necessary in method signature
|
||||
* @id integer - id of accompanyingCourse
|
||||
*/
|
||||
let getAccompanyingCourse = (accompanying_period_id___) => { //tmp
|
||||
const url = `/${locale}/person/api/1.0/accompanying-course/${accompanying_period_id}/show.${format}`;
|
||||
let getAccompanyingCourse = (id) => { //tmp
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
@@ -24,12 +17,12 @@ let getAccompanyingCourse = (accompanying_period_id___) => { //tmp
|
||||
* Endpoint v.2 chill_api_single_accompanying_course_participation,
|
||||
* method POST/DELETE, add/close a participation to the accompanyingCourse
|
||||
*
|
||||
* @accompanying_period_id integer - id of accompanyingCourse
|
||||
* @person_id integer - id of person
|
||||
* @method string - POST or DELETE
|
||||
* @id integer - id of accompanyingCourse
|
||||
* @person_id integer - id of person
|
||||
* @method string - POST or DELETE
|
||||
*/
|
||||
let postParticipation = (accompanying_period_id, person_id, method) => {
|
||||
const url = `/api/1.0/person/accompanying-course/${accompanying_period_id}/participation.${format}`
|
||||
let postParticipation = (id, person_id, method) => {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/participation.json`
|
||||
return fetch(url, {
|
||||
method: method,
|
||||
headers: {
|
||||
|
Reference in New Issue
Block a user