Move delete button for status into a component

This commit is contained in:
Jiayi Zheng 2016-12-07 21:50:46 +01:00
parent 7b5a30db14
commit 1c75feae60
4 changed files with 40 additions and 21 deletions

View file

@ -0,0 +1,16 @@
const DeleteButton = {
props: [ 'status' ],
methods: {
deleteStatus () {
const confirmed = confirm('Do you really want to delete this status?')
if (confirmed) {
this.$store.dispatch('deleteStatus', { id: this.status.id })
}
}
},
computed: {
canDelete () { return this.status.user.rights.delete_others_notice || this.status.user.id == this.$store.state.users.currentUser.id }
}
}
export default DeleteButton