This repository was archived by the owner on Jun 28, 2022. It is now read-only.
Repository navigation
Fix app.delete to return post to res.send(data) - #6
Closed
dglmartins wants to merge 10 commits into
Closed
dglmartins wants to merge 10 commits into
dglmartins wants to merge 10 commits into
Conversation
richardkalehoff
force-pushed
the
master
branch
from
September 12, 2017 22:56
c4a8fca to
87ddb4d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I think the readable server code has a bug on
app.deletewhere thepostreturned bycomments.disableByParentis not returned to the nextapp.deletethen, and as such, there is a error when callingres.json()when fetching. This can cause confusion with students that are trying to use the returned post or that have written the fetch call withres => res.json(). Insideapp.deletein 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),