15 lines
480 B
JavaScript
15 lines
480 B
JavaScript
export function getJson(url) {
|
|
return fetch(url, { headers: getAuthHeaders() }).then(function(r) { return r.json(); });
|
|
}
|
|
|
|
export function sendJson(url, method, payload) {
|
|
return fetch(url, {
|
|
method: method,
|
|
headers: getAuthHeaders(),
|
|
body: JSON.stringify(payload || {})
|
|
}).then(function(r) { return r.json(); });
|
|
}
|
|
|
|
export function deleteJson(url) {
|
|
return fetch(url, { method: 'DELETE', headers: getAuthHeaders() }).then(function(r) { return r.json(); });
|
|
}
|