32 lines
721 B
JavaScript
32 lines
721 B
JavaScript
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();
|