Initial commit
This commit is contained in:
31
client-wiaas/src/configureStore.js
Normal file
31
client-wiaas/src/configureStore.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import {
|
||||
createStore,
|
||||
applyMiddleware
|
||||
} from 'redux';
|
||||
import thunkMiddleware from 'redux-thunk';
|
||||
import {
|
||||
createLogger
|
||||
} from 'redux-logger';
|
||||
import reduxCatch from 'redux-catch';
|
||||
import wiaasReducers from './reducers';
|
||||
|
||||
const loggerMiddleware = createLogger();
|
||||
const errorHandler = (error, getState, lastAction, dispatch) => {
|
||||
console.error(error);
|
||||
console.debug('current state', getState());
|
||||
console.debug('last action was', lastAction);
|
||||
};
|
||||
|
||||
function configureStore() {
|
||||
return createStore(
|
||||
wiaasReducers,
|
||||
applyMiddleware(
|
||||
reduxCatch(errorHandler),
|
||||
thunkMiddleware,
|
||||
loggerMiddleware
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export let store = configureStore();
|
||||
Reference in New Issue
Block a user