diff --git a/webapp/components/Comment.vue b/webapp/components/Comment.vue index 13edc9c0d..5e9c4faca 100644 --- a/webapp/components/Comment.vue +++ b/webapp/components/Comment.vue @@ -19,6 +19,7 @@ @@ -37,6 +38,10 @@ export default { ReportModal, DeleteModal }, + props: { + deleteCallback: { type: Function, required: true }, + cancelCallback: { type: Function, default: null } + }, computed: { ...mapGetters({ data: 'modal/data', diff --git a/webapp/components/Modal/DeleteModal.vue b/webapp/components/Modal/DeleteModal.vue index 8154937db..5a145008d 100644 --- a/webapp/components/Modal/DeleteModal.vue +++ b/webapp/components/Modal/DeleteModal.vue @@ -53,6 +53,8 @@ export default { props: { name: { type: String, default: '' }, type: { type: String, required: true }, + deleteCallback: { type: Function, required: true }, + cancelCallback: { type: Function, default: null }, id: { type: String, required: true } }, data() { @@ -116,12 +118,23 @@ export default { setTimeout(() => { this.success = false this.$emit('close') - if (this.$router.history.current.name === 'post-id-slug') { - // redirect to index - this.$router.history.push('/') - } else { - // reload the page (when deleting from profile or index) - window.location.assign(window.location.href) + switch (this.type) { + case 'contribution': + if (this.$router.history.current.name === 'post-id-slug') { + // redirect to index + this.$router.history.push('/') + } else { + // reload the page (when deleting from profile or index) + window.location.assign(window.location.href) + } + break + case 'comment': + // reload the page + // window.location.assign(window.location.href) + console.log('Remove comment emit !!!') + // this.$parent.$parent.$emit('deleteComment') + this.deleteCallback() + break } }, 500) }, 1500) diff --git a/webapp/components/comments/CommentList/index.vue b/webapp/components/comments/CommentList/index.vue index 57b720087..b77a4cf12 100644 --- a/webapp/components/comments/CommentList/index.vue +++ b/webapp/components/comments/CommentList/index.vue @@ -19,10 +19,18 @@ class="comments" > +