Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ahmed Bouhuolia
2020-12-13 19:51:53 +02:00
2 changed files with 12 additions and 1 deletions

View File

@@ -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) => {

View File

@@ -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'),
});