mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-18 11:08:47 +00:00
sorted posts chronologically everywhere
This commit is contained in:
parent
76792148cd
commit
80a2e1894c
@ -74,6 +74,7 @@ exports.getallPosts = (req, res) => {
|
|||||||
allPosts.forEach(post => {
|
allPosts.forEach(post => {
|
||||||
posts.push(post.data());
|
posts.push(post.data());
|
||||||
});
|
});
|
||||||
|
posts.sort((a, b) => -a.createdAt.localeCompare(b.createdAt));
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@ -127,6 +128,7 @@ exports.getAlert = (req, res) => {
|
|||||||
myPosts.forEach(function(doc) {
|
myPosts.forEach(function(doc) {
|
||||||
posts.push(doc.data());
|
posts.push(doc.data());
|
||||||
});
|
});
|
||||||
|
posts.sort((a, b) => -a.createdAt.localeCompare(b.createdAt));
|
||||||
return res.status(200).json(posts);
|
return res.status(200).json(posts);
|
||||||
})
|
})
|
||||||
.then(function() {
|
.then(function() {
|
||||||
@ -154,6 +156,7 @@ exports.getOtherUsersPosts = (req, res) => {
|
|||||||
myPosts.forEach(function(doc) {
|
myPosts.forEach(function(doc) {
|
||||||
posts.push(doc.data());
|
posts.push(doc.data());
|
||||||
});
|
});
|
||||||
|
posts.sort((a, b) => -a.createdAt.localeCompare(b.createdAt));
|
||||||
return res.status(200).json(posts);
|
return res.status(200).json(posts);
|
||||||
})
|
})
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
|||||||
@ -148,7 +148,7 @@ class Home extends Component {
|
|||||||
<Typography variant="body2">{post.body}</Typography>
|
<Typography variant="body2">{post.body}</Typography>
|
||||||
<br />
|
<br />
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
<b>Topics:</b> {post.microBlogTopics}
|
<b>Topics:</b> {post.microBlogTopics.join(", ")}
|
||||||
</Typography>
|
</Typography>
|
||||||
<br />
|
<br />
|
||||||
<Typography
|
<Typography
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user