You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 28, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 28, 2022. It is now read-only.
Bug in server.js - SyntaxError: Unexpected end of JSON input #8
.then(
(post) => {
comments.disableByParent(req.token, post)
res.send(post)
},
(error) => {
console.error(error)
res.status(500).send({
error: 'There was an error.'
})
})
other wise console.log(data) before (data) => res.send(data) will get undefined, and if you try .then(res => res.json()) after fetch() in your api.js, you will get SyntaxError: Unexpected end of JSON input.
Activity
nathanhannig commentedon Sep 8, 2017
I believe the correct fix is to just remove the curly brackets in the first .then() since disableByParent is a function that returns a Promise.
A pull request was opened here with same
#6
Martian2Lee commentedon Sep 8, 2017
@breakpoint25 Absolutely!