Fix optimistc update for deleting users

This commit is contained in:
Angelina Filippova 2020-07-17 14:15:39 +03:00
parent 434f8ad2dd
commit d211d4f934

View file

@ -193,9 +193,10 @@ const users = {
} catch (_e) { } catch (_e) {
return return
} }
const deletedUsersIds = users.map(deletedUser => deletedUser.id) const updatedUsers = users.map(user => {
const updatedUsers = state.fetchedUsers.filter(user => !deletedUsersIds.includes(user.id)) return { ...user, deactivated: true }
commit('SET_USERS', updatedUsers) })
commit('SWAP_USERS', updatedUsers)
if (_userId) { if (_userId) {
dispatch('FetchUserProfile', { userId: _userId, godmode: false }) dispatch('FetchUserProfile', { userId: _userId, godmode: false })