diff --git a/src/actions/index.js b/src/actions/index.js index d37274c..21d7ba3 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -7,8 +7,10 @@ export const fetchPosts = () => async (dispatch) => { }; export const fetchPost = (slug) => async (dispatch) => { - const response = await sudoscientist.get('/blog/posts/by-slug/' + slug); - dispatch({ type: 'FETCH_POST', payload: response.data }) + const post = await sudoscientist.get('/blog/posts/by-slug/' + slug) + const comments = await sudoscientist.get('/blog/comments/' + post.data.id); + const response = { ...post.data, ...comments.data } + dispatch({ type: 'FETCH_POST', payload: response }) };