From d1c86827104fb2df3c3e90d4e279ae5ea8430fa1 Mon Sep 17 00:00:00 2001 From: Matt Rider Date: Fri, 3 May 2019 15:47:54 -0300 Subject: [PATCH] Update method name to be more descriptive/accurate --- webapp/components/comments/CommentForm/index.vue | 2 +- webapp/components/comments/CommentList/index.vue | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) 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() } },