mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
requestor logic, is_anonymous patch request
This commit is contained in:
@@ -13,6 +13,29 @@ const getAccompanyingCourse = (id) => {
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Endpoint v.2 chill_api_single_accompanying_course__entity
|
||||
* method PATCH, patch AccompanyingCourse Instance
|
||||
*
|
||||
* @id integer - id of accompanyingCourse
|
||||
* @body Object - dictionary with changes to post
|
||||
*/
|
||||
const patchAccompanyingCourse = (id, body) => {
|
||||
console.log('body', body);
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||
return fetch(url, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=utf-8'
|
||||
},
|
||||
body: JSON.stringify(body)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Endpoint v.2 chill_api_single_accompanying_course_participation,
|
||||
* method POST/DELETE, add/close a participation to the accompanyingCourse
|
||||
@@ -50,7 +73,7 @@ const postRequestor = (id, payload, method) => {
|
||||
const typeId = `${payload.result.type}_id`;
|
||||
body[typeId] = payload.result[typeId];
|
||||
};
|
||||
console.log(body);
|
||||
console.log('body', body);
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/requestor.json`;
|
||||
return fetch(url, {
|
||||
method: method,
|
||||
@@ -66,7 +89,8 @@ const postRequestor = (id, payload, method) => {
|
||||
};
|
||||
|
||||
export {
|
||||
getAccompanyingCourse,
|
||||
getAccompanyingCourse,
|
||||
patchAccompanyingCourse,
|
||||
postParticipation,
|
||||
postRequestor
|
||||
};
|
||||
|
Reference in New Issue
Block a user