diff --git a/client/src/store/users/users.actions.js b/client/src/store/users/users.actions.js index 5dcc18d08..3aa7ff9e7 100644 --- a/client/src/store/users/users.actions.js +++ b/client/src/store/users/users.actions.js @@ -54,7 +54,12 @@ export const deleteUser = ({ id }) => { new Promise((resolve, reject) => { ApiService.delete(`users/${id}`) .then((response) => { - dispatch({ type: t.USER_DELETE, id }); + dispatch({ + type: t.USER_DELETE, + payload: { + id, + }, + }); resolve(response); }) .catch((error) => { diff --git a/client/src/store/users/users.reducer.js b/client/src/store/users/users.reducer.js index 41119b344..736f2f8cf 100644 --- a/client/src/store/users/users.reducer.js +++ b/client/src/store/users/users.reducer.js @@ -34,6 +34,12 @@ export default createReducer(initialState, { const { loading } = action.payload; state.loading = loading; }, + [t.USER_DELETE]: (state, action) => { + const { id } = action.payload; + if (typeof state.items[id] !== 'undefined') { + delete state.items[id]; + } + }, ...createTableQueryReducers('USERS'), });