Simplify entries fetching reducer.
parent
e1bd0891fe
commit
e17aaaf79d
|
@ -117,22 +117,9 @@ const credentials = handleActions(
|
||||||
const entries = handleAction(
|
const entries = handleAction(
|
||||||
fetchEntries,
|
fetchEntries,
|
||||||
(state: EntriesType, action: any) => {
|
(state: EntriesType, action: any) => {
|
||||||
if (action.error) {
|
return { ...state,
|
||||||
return { ...state,
|
[action.meta.journal]: fetchTypeIdentityReducer(state[action.meta.journal], action)
|
||||||
[action.meta.journal]: {
|
};
|
||||||
value: null,
|
|
||||||
error: action.payload,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
const fetching = (action.payload === undefined) ? true : undefined;
|
|
||||||
return { ...state,
|
|
||||||
[action.meta.journal]: {
|
|
||||||
fetching,
|
|
||||||
value: (action.payload === undefined) ? null : action.payload,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue