Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Fix app.delete to return post to res.send(data) - #6

Closed
dglmartins wants to merge 10 commits into
udacity:masterfrom
dglmartins:master
Closed

dglmartins wants to merge 10 commits into
udacity:masterfrom
dglmartins:master

Conversation

@dglmartins

Copy link
Copy Markdown

I think the readable server code has a bug on app.delete where the post returned by comments.disableByParent is not returned to the next app.delete then, and as such, there is a error when calling res.json() when fetching. This can cause confusion with students that are trying to use the returned post or that have written the fetch call with res => res.json(). Inside app.delete in the server, changing
.then( (post) => { comments.disableByParent(req.token, post) })

(which returns nothing)
to
.then( (post) => comments.disableByParent(req.token, post) )

or to
.then( (post) => { return comments.disableByParent(req.token, post) })

fixes the bug, returning the post as datato .then((data) => res.send(data),

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants