mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
layout for form
This commit is contained in:
@@ -0,0 +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);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
throw new Error("Error while retrieving social actions: " + response.status +
|
||||
" " + response.statusText);
|
||||
})
|
||||
.then(data => {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve({ status, data });
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export { create };
|
@@ -6,7 +6,7 @@ const findSocialActionsBySocialIssue = (id) => {
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error("Error while retrieving social actions " + response.status
|
||||
+ " " + response.statusText)
|
||||
+ " " + response.statusText);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
|
Reference in New Issue
Block a user