Update method name to be more descriptive/accurate

This commit is contained in:
Matt Rider 2019-05-03 15:47:54 -03:00
parent 31c8b6e35d
commit d1c8682710
2 changed files with 7 additions and 6 deletions

View File

@ -92,7 +92,7 @@ export default {
} }
}) })
.then(res => { .then(res => {
this.$root.$emit('addComment', res.data.CreateComment) this.$root.$emit('refetchPostComments', res.data.CreateComment)
this.$refs.editor.clear() this.$refs.editor.clear()
this.$toast.success(this.$t('post.comment.submitted')) this.$toast.success(this.$t('post.comment.submitted'))
}) })

View File

@ -26,6 +26,7 @@
</div> </div>
<hc-empty <hc-empty
v-else v-else
name="empty"
icon="messages" icon="messages"
/> />
</div> </div>
@ -44,21 +45,21 @@ export default {
}, },
data() { data() {
return { return {
comments: null comments: []
} }
}, },
watch: { watch: {
Post(post) { Post(post) {
this.comments = post[0].comments || {} this.comments = post[0].comments || []
} }
}, },
mounted() { mounted() {
this.$root.$on('addComment', comment => { this.$root.$on('refetchPostComments', comment => {
this.addComment(comment) this.refetchPostComments(comment)
}) })
}, },
methods: { methods: {
addComment(comment) { refetchPostComments(comment) {
this.$apollo.queries.Post.refetch() this.$apollo.queries.Post.refetch()
} }
}, },