diff --git a/webapp/components/comments/CommentForm/index.vue b/webapp/components/comments/CommentForm/index.vue index 585b97dba..9f5197a06 100644 --- a/webapp/components/comments/CommentForm/index.vue +++ b/webapp/components/comments/CommentForm/index.vue @@ -92,7 +92,7 @@ export default { } }) .then(res => { - this.$root.$emit('addComment', res.data.CreateComment) + this.$root.$emit('refetchPostComments', res.data.CreateComment) this.$refs.editor.clear() this.$toast.success(this.$t('post.comment.submitted')) }) diff --git a/webapp/components/comments/CommentList/index.vue b/webapp/components/comments/CommentList/index.vue index ba9ada717..57b720087 100644 --- a/webapp/components/comments/CommentList/index.vue +++ b/webapp/components/comments/CommentList/index.vue @@ -26,6 +26,7 @@ @@ -44,21 +45,21 @@ export default { }, data() { return { - comments: null + comments: [] } }, watch: { Post(post) { - this.comments = post[0].comments || {} + this.comments = post[0].comments || [] } }, mounted() { - this.$root.$on('addComment', comment => { - this.addComment(comment) + this.$root.$on('refetchPostComments', comment => { + this.refetchPostComments(comment) }) }, methods: { - addComment(comment) { + refetchPostComments(comment) { this.$apollo.queries.Post.refetch() } },