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 => {
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'))
})

View File

@ -26,6 +26,7 @@
</div>
<hc-empty
v-else
name="empty"
icon="messages"
/>
</div>
@ -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()
}
},