Update action in dropdown, add confirmation when deleting a user
This commit is contained in:
parent
d008cbdfc7
commit
0b81053f24
1 changed files with 18 additions and 3 deletions
|
@ -72,11 +72,26 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
handleDeactivation({ nickname }) {
|
||||
this.$store.dispatch('ToggleUserActivation', nickname)
|
||||
handleDeactivation(user) {
|
||||
user.deactivated
|
||||
? this.$store.dispatch('ActivateUsers', { users: [user], _userId: user.id })
|
||||
: this.$store.dispatch('DeactivateUsers', { users: [user], _userId: user.id })
|
||||
},
|
||||
handleDeletion(user) {
|
||||
this.$store.dispatch('DeleteUser', user)
|
||||
this.$confirm(
|
||||
this.$t('users.deleteUserConfirmation'),
|
||||
{
|
||||
confirmButtonText: 'Delete',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$store.dispatch('DeleteUsers', { users: [user], _userId: user.id })
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: 'Delete canceled'
|
||||
})
|
||||
})
|
||||
},
|
||||
showDeactivatedButton(id) {
|
||||
return this.$store.state.user.id !== id
|
||||
|
|
Loading…
Reference in a new issue