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) => { new Promise((resolve, reject) => {
ApiService.delete(`users/${id}`) ApiService.delete(`users/${id}`)
.then((response) => { .then((response) => {
dispatch({ type: t.USER_DELETE, id }); dispatch({
type: t.USER_DELETE,
payload: {
id,
},
});
resolve(response); resolve(response);
}) })
.catch((error) => { .catch((error) => {

View File

@@ -34,6 +34,12 @@ export default createReducer(initialState, {
const { loading } = action.payload; const { loading } = action.payload;
state.loading = loading; state.loading = loading;
}, },
[t.USER_DELETE]: (state, action) => {
const { id } = action.payload;
if (typeof state.items[id] !== 'undefined') {
delete state.items[id];
}
},
...createTableQueryReducers('USERS'), ...createTableQueryReducers('USERS'),
}); });