Merge remote-tracking branch 'origin/master' into issue491_thirdparty_edit_modal

This commit is contained in:
2022-03-14 13:43:39 +01:00
29 changed files with 437 additions and 156 deletions

View File

@@ -1,14 +1,20 @@
/**
* Generic api method that can be adapted to any fetch request
*/
const makeFetch = (method, url, body) => {
return fetch(url, {
const makeFetch = (method, url, body, options) => {
let opts = {
method: method,
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: (body !== null) ? JSON.stringify(body) : null
})
};
if (typeof options !== 'undefined') {
opts = Object.assign(opts, options);
}
return fetch(url, opts)
.then(response => {
if (response.ok) {
return response.json();