mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
fetch post resource
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
const getBodyTypeId = (payload) => {
|
||||
const getEntityTypeId = (payload) => {
|
||||
const body = {};
|
||||
if (payload !== null) {
|
||||
body['type'] = payload.type;
|
||||
@@ -56,7 +56,7 @@ const patchAccompanyingCourse = (id, body) => {
|
||||
* @method string - POST or DELETE
|
||||
*/
|
||||
const postParticipation = (id, payload, method) => {
|
||||
const body = getBodyTypeId(payload);
|
||||
const body = getEntityTypeId(payload);
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/participation.json`;
|
||||
return fetch(url, {
|
||||
method: method,
|
||||
@@ -80,7 +80,7 @@ const postParticipation = (id, payload, method) => {
|
||||
* @method string - POST or DELETE
|
||||
*/
|
||||
const postRequestor = (id, payload, method) => {
|
||||
const body = getBodyTypeId(payload);
|
||||
const body = getEntityTypeId(payload);
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/requestor.json`;
|
||||
return fetch(url, {
|
||||
method: method,
|
||||
@@ -104,7 +104,14 @@ const postRequestor = (id, payload, method) => {
|
||||
* @method string - POST or DELETE
|
||||
*/
|
||||
const postResource = (id, payload, method) => {
|
||||
const body = getBodyTypeId(payload);
|
||||
console.log('payload', payload);
|
||||
const body = { type: "accompanying_period_resource" };
|
||||
if (method === 'DELETE') {
|
||||
body['id'] = payload.id;
|
||||
} else {
|
||||
body['resource'] = getEntityTypeId(payload);
|
||||
}
|
||||
console.log('body', body);
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/resource.json`;
|
||||
return fetch(url, {
|
||||
method: method,
|
||||
|
Reference in New Issue
Block a user