Implement apollo reporter middleware

This commit is contained in:
Chi Vinh Le
2017-04-05 11:10:37 +07:00
parent 4a49a910aa
commit 18d6846f4e
+12 -2
View File
@@ -3,9 +3,19 @@ import thunk from 'redux-thunk';
import mainReducer from '../reducers';
import {client} from './client';
const apolloErrorReporter = () => next => action => {
if (action.type === 'APOLLO_QUERY_ERROR') {
console.error(action.error);
}
return next(action);
};
const middlewares = [
applyMiddleware(client.middleware()),
applyMiddleware(thunk)
applyMiddleware(
client.middleware(),
thunk,
apolloErrorReporter,
),
];
if (window.devToolsExtension) {