From a4b7f7a107a17446a6bc92fe28ce52394e06e8ac Mon Sep 17 00:00:00 2001 From: shobhitm23 Date: Thu, 31 Oct 2019 14:15:40 -0400 Subject: [PATCH] Added post.id in backend to display posts --- functions/handlers/post.js | 1 + twistter-frontend/src/pages/user.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/functions/handlers/post.js b/functions/handlers/post.js index 35c38df..14c73b9 100644 --- a/functions/handlers/post.js +++ b/functions/handlers/post.js @@ -61,6 +61,7 @@ exports.getAllPosts = (req, res) => { userImage: doc.data().userImage, microBlogTitle: doc.data().microBlogTitle, microBlogTopics: doc.data().microBlogTopics, + id: doc.id, }); }); return res.status(200).json(posts); diff --git a/twistter-frontend/src/pages/user.js b/twistter-frontend/src/pages/user.js index 34627c9..b0b37a8 100644 --- a/twistter-frontend/src/pages/user.js +++ b/twistter-frontend/src/pages/user.js @@ -92,9 +92,10 @@ class user extends Component { label={{topic}.topic.topic} onDelete={handleDelete}/>) ) : (

loading topics...

); - - let recentPostsMarkup = this.state.posts ? ( - this.state.posts.map(post => ) + + let posts = classes.data + let recentPostsMarkup = posts ? ( + this.state.posts.map(post => ) ) : (

Loading...

); return (