From 25e536bf7e5f589eba909c8e7f51edc49bde1bf9 Mon Sep 17 00:00:00 2001 From: Asara Date: Wed, 29 Jan 2020 20:39:48 -0500 Subject: [PATCH] Add comments as a child of the post --- src/actions/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/actions/index.js b/src/actions/index.js index 56164d0..fe98b11 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -9,7 +9,8 @@ export const fetchPosts = () => async (dispatch) => { export const fetchPost = (slug) => async (dispatch) => { const post = await sudoscientist.get('/blog/posts/by-slug/' + slug) const comments = await sudoscientist.get('/blog/comments/' + post.data.id); - const response = { post: post.data, comments: comments.data } + const response = { post: post.data } + response.post.comments = comments.data dispatch({ type: 'FETCH_POST', payload: response }) };