Confirm post request, change state step and hide components

This commit is contained in:
2021-05-20 11:45:29 +02:00
parent 050c325195
commit ae1146c79c
5 changed files with 67 additions and 30 deletions

View File

@@ -13,18 +13,6 @@ const getAccompanyingCourse = (id) => {
});
};
/*
* Endpoint
*/
const getSocialIssues = () => {
const url = `/api/1.0/person/social-work/social-issue.json`;
return fetch(url)
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
});
};
/*
* Endpoint v.2 chill_api_single_accompanying_course__entity
* method PATCH, patch AccompanyingCourse Instance
@@ -48,6 +36,33 @@ const patchAccompanyingCourse = (id, body) => {
});
};
/*
* Endpoint to change 'DRAFT' step to 'CONFIRMED'
*/
const confirmAccompanyingCourse = (id) => {
const url = `/api/1.0/person/accompanying-course/${id}/confirm.json`
return fetch(url, {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=utf-8'}
})
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
});
};
/*
* Endpoint
*/
const getSocialIssues = () => {
const url = `/api/1.0/person/social-work/social-issue.json`;
return fetch(url)
.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
@@ -133,8 +148,9 @@ const postResource = (id, payload, method) => {
export {
getAccompanyingCourse,
getSocialIssues,
patchAccompanyingCourse,
confirmAccompanyingCourse,
getSocialIssues,
postParticipation,
postRequestor,
postResource,