fixed reducer for FETCH_USER_SUCCESS

This commit is contained in:
Sebastian Sdorra
2018-07-25 09:44:48 +02:00
parent cd313b5f97
commit 978565609a
2 changed files with 43 additions and 16 deletions

View File

@@ -374,25 +374,18 @@ export default function reducer(state: any = {}, action: any = {}) {
});
case FETCH_USER_SUCCESS:
const ubn = extractUsersByNames(
[action.payload],
[action.payload.name],
state.usersByNames
);
return {
...state,
users: {
error: null,
entries: [action.payload.name],
loading: false
},
usersByNames: ubn
};
return reduceUsersByNames(state, action.payload.name, {
loading: false,
error: null,
entry: action.payload
});
case FETCH_USER_FAILURE:
return reduceUsersByNames(state, action.payload.username, {
loading: true,
error: action.payload.error
});
// Delete single user cases
case DELETE_USER:
return reduceUsersByNames(state, action.payload.name, {