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: {
|
actions: {
|
||||||
async ActivateUsers({ commit, getters }, nicknames) {
|
async ActivateUsers({ commit, getters }, users) {
|
||||||
const { data } = await activateUsers(nicknames, getters.authHost, getters.token)
|
const usersNicknames = users.map(user => user.nickname)
|
||||||
|
const { data } = await activateUsers(usersNicknames, getters.authHost, getters.token)
|
||||||
commit('SWAP_USERS', data)
|
commit('SWAP_USERS', data)
|
||||||
},
|
},
|
||||||
async AddRight({ dispatch, getters, state }, { users, right }) {
|
async AddRight({ dispatch, getters, state }, { users, right }) {
|
||||||
|
@ -103,8 +104,9 @@ const users = {
|
||||||
await createNewAccount(nickname, email, password, getters.authHost, getters.token)
|
await createNewAccount(nickname, email, password, getters.authHost, getters.token)
|
||||||
dispatch('FetchUsers', { page: state.currentPage })
|
dispatch('FetchUsers', { page: state.currentPage })
|
||||||
},
|
},
|
||||||
async DeactivateUsers({ commit, getters }, nicknames) {
|
async DeactivateUsers({ commit, getters }, users) {
|
||||||
const { data } = await deactivateUsers(nicknames, getters.authHost, getters.token)
|
const usersNicknames = users.map(user => user.nickname)
|
||||||
|
const { data } = await deactivateUsers(usersNicknames, getters.authHost, getters.token)
|
||||||
commit('SWAP_USERS', data)
|
commit('SWAP_USERS', data)
|
||||||
},
|
},
|
||||||
async DeleteRight({ dispatch, getters, state }, { users, right }) {
|
async DeleteRight({ dispatch, getters, state }, { users, right }) {
|
||||||
|
|
|
@ -148,10 +148,10 @@ export default {
|
||||||
showDeactivatedButton(id) {
|
showDeactivatedButton(id) {
|
||||||
return this.$store.state.user.id !== id
|
return this.$store.state.user.id !== id
|
||||||
},
|
},
|
||||||
toggleActivation({ deactivated, nickname }) {
|
toggleActivation(user) {
|
||||||
deactivated
|
user.deactivated
|
||||||
? this.$store.dispatch('ActivateUsers', [nickname])
|
? this.$store.dispatch('ActivateUsers', [user])
|
||||||
: this.$store.dispatch('DeactivateUsers', [nickname])
|
: this.$store.dispatch('DeactivateUsers', [user])
|
||||||
},
|
},
|
||||||
toggleTag(user, tag) {
|
toggleTag(user, tag) {
|
||||||
user.tags.includes(tag)
|
user.tags.includes(tag)
|
||||||
|
|
|
@ -275,10 +275,10 @@ export default {
|
||||||
|
|
||||||
this.$store.dispatch('RequirePasswordReset', { nickname })
|
this.$store.dispatch('RequirePasswordReset', { nickname })
|
||||||
},
|
},
|
||||||
toggleActivation({ deactivated, nickname }) {
|
toggleActivation(user) {
|
||||||
deactivated
|
user.deactivated
|
||||||
? this.$store.dispatch('ActivateUsers', [nickname])
|
? this.$store.dispatch('ActivateUsers', [user])
|
||||||
: this.$store.dispatch('DeactivateUsers', [nickname])
|
: this.$store.dispatch('DeactivateUsers', [user])
|
||||||
},
|
},
|
||||||
handleDeletion(user) {
|
handleDeletion(user) {
|
||||||
this.$store.dispatch('DeleteUser', user)
|
this.$store.dispatch('DeleteUser', user)
|
||||||
|
|
Loading…
Reference in a new issue