Redux News Reader Project steps 12 - 14

I was stuck for hours on steps 12 - 14 for the Redux News Reader

Eventually figured out what was wrong. Since it was an easy detail to miss, I figured I would make a post about it to help others who may encounter this issue in the future.

Intially, inside the postCommentForArticleId

action creator (located in commentsSlice.js ) I had declared:

const requestBody = JSON.stringify(comment);

instead of:

const requestBody = JSON.stringify({comment: comment});

I spent hours trying to figure out why my attempt to post a new comment would always return an object without the text property (under actions.payload I would only see an object with id and articleId properties but no text property).

Essentially my mistake was that assigned a string value to the requestBody const and was passing that to the body property in the options object (for the fetch method).

Turns out that if the value for body is not an object, the fetch method does not return a text value.

Hope this is helpful :slight_smile: