2017-08-16 22:51:37 +00:00
|
|
|
import 'babel-polyfill';
|
|
|
|
import 'regenerator-runtime/runtime';
|
|
|
|
|
2017-08-13 01:35:09 +00:00
|
|
|
import { createStore, applyMiddleware } from 'redux';
|
2017-08-16 22:51:37 +00:00
|
|
|
import createSagaMiddleware from 'redux-saga';
|
2017-08-13 01:35:09 +00:00
|
|
|
import logger from 'redux-logger';
|
2017-08-17 06:28:41 +00:00
|
|
|
import reducers from '../reducers';
|
2017-08-17 00:24:06 +00:00
|
|
|
import sagas from '../sagas';
|
2017-08-13 01:35:09 +00:00
|
|
|
|
2017-08-16 22:51:37 +00:00
|
|
|
const sagaMiddleware = createSagaMiddleware();
|
|
|
|
let middleware;
|
2017-08-13 01:35:09 +00:00
|
|
|
|
|
|
|
if (__DEV__) {
|
|
|
|
/* eslint-disable global-require */
|
|
|
|
const reduxImmutableStateInvariant = require('redux-immutable-state-invariant').default();
|
2017-08-16 22:51:37 +00:00
|
|
|
middleware = [sagaMiddleware, reduxImmutableStateInvariant, logger];
|
2017-08-13 01:35:09 +00:00
|
|
|
} else {
|
2017-08-16 22:51:37 +00:00
|
|
|
middleware = [sagaMiddleware];
|
2017-08-13 01:35:09 +00:00
|
|
|
}
|
|
|
|
|
2017-08-13 23:02:46 +00:00
|
|
|
export default createStore(
|
2017-08-17 06:28:41 +00:00
|
|
|
reducers,
|
2017-08-16 22:51:37 +00:00
|
|
|
applyMiddleware(sagaMiddleware)
|
2017-08-13 23:02:46 +00:00
|
|
|
);
|
2017-08-17 00:24:06 +00:00
|
|
|
sagaMiddleware.run(sagas);
|