akkoma-fe/src/components/delete_button/delete_button.js

22 lines
618 B
JavaScript
Raw Normal View History

const DeleteButton = {
props: [ 'status' ],
methods: {
deleteStatus () {
2017-02-22 21:43:40 +00:00
const confirmed = window.confirm('Do you really want to delete this status?')
if (confirmed) {
this.$store.dispatch('deleteStatus', { id: this.status.id })
}
}
},
computed: {
2016-12-08 19:26:05 +00:00
currentUser () { return this.$store.state.users.currentUser },
2019-02-18 14:49:32 +00:00
canDelete () {
if (!this.currentUser) { return }
const superuser = this.currentUser.rights.moderator || this.currentUser.rights.admin
return superuser || this.status.user.id === this.currentUser.id
}
}
}
export default DeleteButton