Added post.id in backend to display posts

This commit is contained in:
shobhitm23 2019-10-31 14:15:40 -04:00
parent 7341de742e
commit a4b7f7a107
2 changed files with 5 additions and 3 deletions

View File

@ -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);

View File

@ -92,9 +92,10 @@ class user extends Component {
label={{topic}.topic.topic}
onDelete={handleDelete}/>)
) : (<p> loading topics...</p>);
let recentPostsMarkup = this.state.posts ? (
this.state.posts.map(post => <Posts key={post.createdAt} post={post}/>)
let posts = classes.data
let recentPostsMarkup = posts ? (
this.state.posts.map(post => <Posts key={post.id} post={post}/>)
) : ( <p> Loading... </p> );
return (