forked from AkkomaGang/admin-fe
Pass users instead of nicknames to actions that toggle activation
This commit is contained in:
parent
77a153deac
commit
42f73e6c79
3 changed files with 14 additions and 12 deletions
|
@ -77,8 +77,9 @@ const users = {
|
|||
}
|
||||
},
|
||||
actions: {
|
||||
async ActivateUsers({ commit, getters }, nicknames) {
|
||||
const { data } = await activateUsers(nicknames, getters.authHost, getters.token)
|
||||
async ActivateUsers({ commit, getters }, users) {
|
||||
const usersNicknames = users.map(user => user.nickname)
|
||||
const { data } = await activateUsers(usersNicknames, getters.authHost, getters.token)
|
||||
commit('SWAP_USERS', data)
|
||||
},
|
||||
async AddRight({ dispatch, getters, state }, { users, right }) {
|
||||
|
@ -103,8 +104,9 @@ const users = {
|
|||
await createNewAccount(nickname, email, password, getters.authHost, getters.token)
|
||||
dispatch('FetchUsers', { page: state.currentPage })
|
||||
},
|
||||
async DeactivateUsers({ commit, getters }, nicknames) {
|
||||
const { data } = await deactivateUsers(nicknames, getters.authHost, getters.token)
|
||||
async DeactivateUsers({ commit, getters }, users) {
|
||||
const usersNicknames = users.map(user => user.nickname)
|
||||
const { data } = await deactivateUsers(usersNicknames, getters.authHost, getters.token)
|
||||
commit('SWAP_USERS', data)
|
||||
},
|
||||
async DeleteRight({ dispatch, getters, state }, { users, right }) {
|
||||
|
|
|
@ -148,10 +148,10 @@ export default {
|
|||
showDeactivatedButton(id) {
|
||||
return this.$store.state.user.id !== id
|
||||
},
|
||||
toggleActivation({ deactivated, nickname }) {
|
||||
deactivated
|
||||
? this.$store.dispatch('ActivateUsers', [nickname])
|
||||
: this.$store.dispatch('DeactivateUsers', [nickname])
|
||||
toggleActivation(user) {
|
||||
user.deactivated
|
||||
? this.$store.dispatch('ActivateUsers', [user])
|
||||
: this.$store.dispatch('DeactivateUsers', [user])
|
||||
},
|
||||
toggleTag(user, tag) {
|
||||
user.tags.includes(tag)
|
||||
|
|
|
@ -275,10 +275,10 @@ export default {
|
|||
|
||||
this.$store.dispatch('RequirePasswordReset', { nickname })
|
||||
},
|
||||
toggleActivation({ deactivated, nickname }) {
|
||||
deactivated
|
||||
? this.$store.dispatch('ActivateUsers', [nickname])
|
||||
: this.$store.dispatch('DeactivateUsers', [nickname])
|
||||
toggleActivation(user) {
|
||||
user.deactivated
|
||||
? this.$store.dispatch('ActivateUsers', [user])
|
||||
: this.$store.dispatch('DeactivateUsers', [user])
|
||||
},
|
||||
handleDeletion(user) {
|
||||
this.$store.dispatch('DeleteUser', user)
|
||||
|
|
Loading…
Reference in a new issue