summaryrefslogtreecommitdiff
path: root/app/client/api/crud.fetch.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/client/api/crud.fetch.js')
-rw-r--r--app/client/api/crud.fetch.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/app/client/api/crud.fetch.js b/app/client/api/crud.fetch.js
index 421510b..716ab3e 100644
--- a/app/client/api/crud.fetch.js
+++ b/app/client/api/crud.fetch.js
@@ -10,7 +10,7 @@ export function crud_fetch(type, tag) {
},
show: id => {
- return fetch(uri + id)
+ return fetch(uri + id, _get_headers(), _get_headers())
.then(req => req.json())
.catch(error)
},
@@ -45,15 +45,17 @@ function _get_url(_url, data) {
function _get_headers() {
return {
method: 'GET',
+ credentials: 'same-origin',
headers: {
'Accept': 'application/json',
},
}
}
-function post(data) {
+export function post(data) {
return {
method: 'POST',
body: JSON.stringify(data),
+ credentials: 'same-origin',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
@@ -64,25 +66,28 @@ export function postBody(data) {
return {
method: 'POST',
body: data,
+ credentials: 'same-origin',
headers: {
'Accept': 'application/json',
},
}
}
-function put(data) {
+export function put(data) {
return {
method: 'PUT',
body: JSON.stringify(data),
+ credentials: 'same-origin',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
}
}
-function destroy(data) {
+export function destroy(data) {
return {
method: 'DELETE',
body: JSON.stringify(data),
+ credentials: 'same-origin',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'