forked from AkkomaGang/admin-fe
Fix filter logic to work with multiple choice on different pages
This commit is contained in:
parent
c425cd8aec
commit
5f0289c363
1 changed files with 3 additions and 8 deletions
|
@ -21,14 +21,9 @@ const users = {
|
||||||
SET_LOADING: (state, status) => {
|
SET_LOADING: (state, status) => {
|
||||||
state.loading = status
|
state.loading = status
|
||||||
},
|
},
|
||||||
SWAP_USER: (state, user) => {
|
SWAP_USER: (state, updatedUser) => {
|
||||||
const usersWithoutSwapped = state.fetchedUsers.filter(u => {
|
const updated = state.fetchedUsers.map(user => user.id === updatedUser.id ? updatedUser : user)
|
||||||
return u.id !== user.id
|
state.fetchedUsers = updated.sort((a, b) => a.nickname.localeCompare(b.nickname))
|
||||||
})
|
|
||||||
|
|
||||||
state.fetchedUsers = [...usersWithoutSwapped, user].sort((a, b) =>
|
|
||||||
a.nickname.localeCompare(b.nickname)
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
SET_COUNT: (state, count) => {
|
SET_COUNT: (state, count) => {
|
||||||
state.totalUsersCount = count
|
state.totalUsersCount = count
|
||||||
|
|
Loading…
Reference in a new issue