From 06bf21248e4e56def3efcad5a3214f73d24a3c00 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 21 Feb 2020 16:20:20 +0200 Subject: [PATCH] Add journal and entry error handling to the global error handling. --- src/store/reducers.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/store/reducers.ts b/src/store/reducers.ts index 5eb0c4f..0d0ea42 100644 --- a/src/store/reducers.ts +++ b/src/store/reducers.ts @@ -241,6 +241,20 @@ export const fetchCount = handleAction( export const errorsReducer = handleActions( { + [combineActions( + actions.fetchListJournal, + actions.addJournal, + actions.updateJournal, + actions.deleteJournal, + actions.fetchEntries, + actions.addEntries + ).toString()]: (state: List, action: Action) => { + if (action.error) { + return state.push(action.payload); + } + + return state; + }, [actions.addError.toString()]: (state: List, action: Action) => { return state.push(action.payload); },