2019-09-09 06:23:41 +02:00
|
|
|
const apiCall = (method) => (url, body) =>
|
2019-07-28 09:03:11 +02:00
|
|
|
fetch(url, {
|
|
|
|
method: method,
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
},
|
|
|
|
body: body && JSON.stringify(body),
|
2019-08-19 22:18:23 +02:00
|
|
|
});
|
2019-07-28 09:03:11 +02:00
|
|
|
|
2019-09-09 06:23:41 +02:00
|
|
|
const post = apiCall("POST");
|
|
|
|
const get = apiCall("GET");
|
|
|
|
const patch = apiCall("PATCH");
|
|
|
|
const del = apiCall("DELETE");
|
2019-07-28 09:03:11 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
post, get, patch, delete:del
|
|
|
|
};
|