summaryrefslogtreecommitdiff
path: root/bucky
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-15 07:48:08 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-15 07:48:08 +0100
commit6ff7fbaf47792b20762271d006e3580b35745556 (patch)
tree8cd1ace290ae20817d57702dae5d715b13491219 /bucky
parent2ceadc675db75913f31586edfc965aa35ecb5b9d (diff)
layer
Diffstat (limited to 'bucky')
-rw-r--r--bucky/app/federate.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/bucky/app/federate.js b/bucky/app/federate.js
index 01b85a1..e5843d7 100644
--- a/bucky/app/federate.js
+++ b/bucky/app/federate.js
@@ -18,6 +18,9 @@ module.exports = {
new model(req.body).save().then((el) => {
res.el = el;
next()
+ }).catch(e => {
+ console.error(e)
+ next()
})
}
}
@@ -49,6 +52,9 @@ module.exports = {
return promises
}).then( () => {
next()
+ }).catch(e => {
+ console.error(e)
+ next()
})
}
function send(type, data){
@@ -56,9 +62,13 @@ module.exports = {
var json = data.toJSON()
fetch("https://bucky.asdf.us/raw/import/" + type, {
method: 'PUT',
- body: json,
- headers: { 'content-type': 'application/json; charset=utf-8' },
- }).then(() => {})
+ body: JSON.stringify(json),
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ },
+ }).then((res) => {return res.json()})
+ .then((json) => console.log(json))
}
}