28 lines
865 B
JavaScript

const
locale = 'fr',
format = 'json',
accompanying_period_id = () => window.accompanyingCourseId
;
// 1. chill_person_accompanying_course_api_show
let getAccompanyingCourse = (accompanying_period_id) => {
const url = `/${locale}/person/api/1.0/accompanying-course/${accompanying_period_id}/show.${format}`;
return fetch(url)
.then(response => response.json());
};
// 2. chill_person_accompanying_course_api_add_participation (POST)
let getParticipations = (accompanying_period_id) => {
const url = `/${locale}/person/api/1.0/accompanying-course/${accompanying_period_id}/participation.${format}`
return fetch(url)
.then(response => response.json());
};
export { getAccompanyingCourse, getParticipations };
/// TODO
// * cfr. promise.all() pour plusieurs promesses
// * catch throw sur le dernier then pour capturer l'erreur