Adding an unrelated to issue to an accompanyingCourseWork

This commit is contained in:
2021-12-12 13:55:22 +00:00
committed by Julien Fastré
parent 839fb4a211
commit 683d055088
12 changed files with 687 additions and 578 deletions

View File

@@ -1,30 +1,30 @@
const create = (accompanying_period_id, payload) => {
const url = `/api/1.0/person/accompanying-course/${accompanying_period_id}/work.json`;
let status;
console.log('create', payload);
// const create = (accompanying_period_id, payload) => {
// const url = `/api/1.0/person/accompanying-course/${accompanying_period_id}/work.json`;
// let status;
// console.log('create', payload);
return fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
})
.then(response => {
if (response.ok || response.status === 422) {
status = response.status;
// return fetch(url, {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json',
// },
// body: JSON.stringify(payload),
// })
// .then(response => {
// if (response.ok || response.status === 422) {
// status = response.status;
return response.json();
}
// return response.json();
// }
throw new Error("Error while retrieving social actions: " + response.status +
" " + response.statusText);
})
.then(data => {
return new Promise((resolve, reject) => {
resolve({ status, data });
});
});
};
// throw new Error("Error while retrieving social actions: " + response.status +
// " " + response.statusText);
// })
// .then(data => {
// return new Promise((resolve, reject) => {
// resolve({ status, data });
// });
// });
// };
export { create };
// export { create };