delete_button.js (532B)
1 const DeleteButton = { 2 props: [ 'status' ], 3 methods: { 4 deleteStatus () { 5 const confirmed = window.confirm('Do you really want to delete this status?') 6 if (confirmed) { 7 this.$store.dispatch('deleteStatus', { id: this.status.id }) 8 } 9 } 10 }, 11 computed: { 12 currentUser () { return this.$store.state.users.currentUser }, 13 canDelete () { return this.currentUser && this.currentUser.rights.delete_others_notice || this.status.user.id === this.currentUser.id } 14 } 15 } 16 17 export default DeleteButton