@@ -67,7 +67,7 @@
return this.$store.state.thread.thread;
},
posts () {
- return this.$store.state.thread.posts;
+ return this.$store.getters.sortedPosts;
replyUsername () {
return this.$store.state.thread.reply.username
@@ -13,7 +13,13 @@ const state = {
}
-const getters = {}
+const getters = {
+ sortedPosts (state) {
+ return state.posts.sort((a, b) => {
+ return new Date(a.createdAt) - new Date(b.createdAt)
+ })
+ }
+}
const actions = {
addPostAsync ({ state, commit, rootState }, vue) {