diff --git a/functions/handlers/post.js b/functions/handlers/post.js
index 831dba9..816e8a8 100644
--- a/functions/handlers/post.js
+++ b/functions/handlers/post.js
@@ -118,8 +118,13 @@ exports.getallPostsforFeed = (req, res) => {
admin.firestore().collection('posts').get()
.then((data) => {
let posts = [];
+
data.forEach(function(doc) {
- posts.push(doc.data());
+ posts.push( {
+ microBlogs: doc.data(),
+ id: doc.id,
+ })
+
});
return res.status(200).json(posts);
})
diff --git a/twistter-frontend/src/App.js b/twistter-frontend/src/App.js
index b4659ae..c80c0f1 100644
--- a/twistter-frontend/src/App.js
+++ b/twistter-frontend/src/App.js
@@ -33,8 +33,7 @@ import Delete from './pages/Delete';
import writeMicroblog from './Writing_Microblogs.js';
import editProfile from './pages/editProfile';
import userLine from './Userline.js';
-import like from './Like.js';
-import quote from './Quote.js';
+
import feed from './Feed.js';
const theme = createMuiTheme(themeObject);
@@ -82,8 +81,6 @@ class App extends Component {
-
-
diff --git a/twistter-frontend/src/Feed.js b/twistter-frontend/src/Feed.js
index 3b301d2..07cc9e9 100644
--- a/twistter-frontend/src/Feed.js
+++ b/twistter-frontend/src/Feed.js
@@ -5,6 +5,10 @@ import Box from '@material-ui/core/Box';
//import {connect } from 'react-redux';
//import { likePost, unlikePost } from '../redux/actions/dataActions';
//import PropTypes from 'prop-types';
+import Like from "./Like.js";
+import Route from 'react-router-dom/Route';
+
+import Quote from "./Quote.js";
class Feed extends Component {
@@ -13,20 +17,22 @@ class Feed extends Component {
constructor(props) {
super(props);
this.state = {
- microBlogs: []
+ microBlogs: [],
+
};
+
+
}
- componentDidMount() {
+ componentDidMount() {
- axios.get('/getallPostsforFeed')
- .then(res => {
+ axios.get("https://us-central1-twistter-e4649.cloudfunctions.net/api/getallPostsforFeed")
+ .then((res) => {
const post = res.data;
this.setState({microBlogs : post})
- })
-
- }
+ })
+ }
render() {
@@ -34,6 +40,7 @@ class Feed extends Component {
const sortedPosts = (this.state.microBlogs).sort((a,b) =>
-a.createdAt.localeCompare(b.createdAt)
)
+
return(
@@ -48,10 +55,18 @@ class Feed extends Component {
" " + microBlog.createdAt.substring(11,19)}
Who wrote the microBlog: {microBlog.userHandle}
Body of post: {microBlog.body}
+ ID of post: {microBlog.id}
Tagged topics: {microBlog.microBlogTopics.join("," + " ")}