about summary refs log tree commit diff
path: root/app/assets/javascripts/components/store/configureStore.jsx
blob: 3d03d4c193184f1ff77547c4d66848d3e132b1d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
import { createStore, applyMiddleware, compose } from 'redux';
import thunk                                     from 'redux-thunk';
import appReducer                                from '../reducers';
import { loadingBarMiddleware }                  from 'react-redux-loading-bar';
import errorsMiddleware                          from '../middleware/errors';

export default function configureStore(initialState) {
  return createStore(appReducer, initialState, compose(applyMiddleware(thunk, loadingBarMiddleware({
    promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'],
  }), errorsMiddleware()), window.devToolsExtension ? window.devToolsExtension() : f => f));
};