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) => {
|
||||
state.loading = status
|
||||
},
|
||||
SWAP_USER: (state, user) => {
|
||||
const usersWithoutSwapped = state.fetchedUsers.filter(u => {
|
||||
return u.id !== user.id
|
||||
})
|
||||
|
||||
state.fetchedUsers = [...usersWithoutSwapped, user].sort((a, b) =>
|
||||
a.nickname.localeCompare(b.nickname)
|
||||
)
|
||||
SWAP_USER: (state, updatedUser) => {
|
||||
const updated = state.fetchedUsers.map(user => user.id === updatedUser.id ? updatedUser : user)
|
||||
state.fetchedUsers = updated.sort((a, b) => a.nickname.localeCompare(b.nickname))
|
||||
},
|
||||
SET_COUNT: (state, count) => {
|
||||
state.totalUsersCount = count
|
||||
|
|
Loading…
Reference in a new issue