diff --git a/src/store/modules/users.js b/src/store/modules/users.js index 80fb0c223ff2e14499d2cb2c17bcc54daa5d34d1..f1bc0023af46b5b92e78d3927f756cfc6ac09a09 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -65,17 +65,15 @@ const users = { await createNewAccount(nickname, email, password, getters.authHost, getters.token) dispatch('FetchUsers', { page: state.currentPage }) }, - async DeleteUser({ commit, getters }, user) { - await deleteUser(user.nickname, getters.authHost, getters.token) - const updatedUser = { ...user, deactivated: true } - commit('SWAP_USER', updatedUser) + async DeleteUser({ commit, dispatch, getters, state }, user) { + const { data } = await deleteUser(user.nickname, getters.authHost, getters.token) + const users = state.fetchedUsers.filter(user => user.nickname !== data) + commit('SET_USERS', users) }, async FetchUsers({ commit, state, getters }, { page }) { commit('SET_LOADING', true) - const filters = Object.keys(state.filters).filter(filter => state.filters[filter]).join() const response = await fetchUsers(filters, getters.authHost, getters.token, page) - loadUsers(commit, page, response.data) }, async RemoveTag({ commit, getters }, { users, tag }) {