diff --git a/functions/handlers/post.js b/functions/handlers/post.js
index 407a85c..2ccdc8e 100644
--- a/functions/handlers/post.js
+++ b/functions/handlers/post.js
@@ -105,12 +105,11 @@ exports.quoteWithPost = (req, res) => {
})
}
else {
- console.log("Post has already been quoted.");
return res.status(400).json({ error: 'Post has already been quoted.' });
}
})
.catch((err) => {
- return res.status(500).json({error: 'Something is wrong'});
+ return res.status(500).json({error: err});
})
@@ -151,7 +150,6 @@ exports.quoteWithoutPost = (req, res) => {
})
}
else {
- console.log("Post has already been quoted.");
return res.status(400).json({ error: 'Post has already been quoted.' });
}
})
diff --git a/twistter-frontend/src/pages/Home.js b/twistter-frontend/src/pages/Home.js
index ff90580..fd288c0 100644
--- a/twistter-frontend/src/pages/Home.js
+++ b/twistter-frontend/src/pages/Home.js
@@ -32,6 +32,9 @@ class Home extends Component {
this.setState({
posts: res.data
})
+ this.setState({posts: (this.state.posts).sort((a,b) =>
+ -a.createdAt.localeCompare(b.createdAt))
+ })
})
.catch(err => console.log(err));
}
@@ -51,14 +54,15 @@ class Home extends Component {
}
{post.userHandle}
- {post.createdAt}
+ {post.createdAt.substring(0,10) +
+ " " + post.createdAt.substring(11,19)}
{post.microBlogTitle}
{post.body}
- Topics: {post.microBlogTopics}
+ Topics: {post.microBlogTopics.join("," + " ")}
- Likes {post.likeCount} Comments {post.commentCount}
+ Likes {post.likeCount}
diff --git a/twistter-frontend/src/pages/user.js b/twistter-frontend/src/pages/user.js
index 3340b47..cada325 100644
--- a/twistter-frontend/src/pages/user.js
+++ b/twistter-frontend/src/pages/user.js
@@ -95,6 +95,9 @@ class user extends Component {
this.setState({
posts: res.data
})
+ this.setState({posts: (this.state.posts).sort((a,b) =>
+ -a.createdAt.localeCompare(b.createdAt))
+ })
})
.catch(err => console.log(err));
}
@@ -124,7 +127,9 @@ class user extends Component {
let imageMarkup = this.state.imageUrl ? (
) :
(
);
-
+
+
+
let postMarkup = this.state.posts ? (
this.state.posts.map(post =>
@@ -136,14 +141,15 @@ class user extends Component {
}
{post.userHandle}
- {post.createdAt}
+ {post.createdAt.substring(0,10) +
+ " " + post.createdAt.substring(11,19)}
{post.microBlogTitle}
{post.body}
- Topics: {post.microBlogTopics}
+ Topics: {post.microBlogTopics.join("," + " ")}
- Likes {post.likeCount} Comments {post.commentCount}
+ Likes {post.likeCount}
)