2016-10-20 04:14:26 +03:00
|
|
|
const createLogger = require('redux-logger');
|
|
|
|
const enableBatching = require('redux-batched-actions').enableBatching;
|
|
|
|
const promiseMiddleware = require('redux-promise-middleware').default;
|
|
|
|
const redux = require('redux');
|
|
|
|
const thunk = require('redux-thunk').default;
|
|
|
|
|
2016-12-05 22:28:10 +02:00
|
|
|
const createReducer = require('@state/reducers');
|
|
|
|
|
2016-10-20 04:14:26 +03:00
|
|
|
const {
|
|
|
|
createStore,
|
|
|
|
compose,
|
|
|
|
applyMiddleware
|
|
|
|
} = redux;
|
|
|
|
|
|
|
|
module.exports = (state = Object.freeze({})) => {
|
|
|
|
return createStore(
|
|
|
|
enableBatching(createReducer()),
|
|
|
|
state,
|
|
|
|
compose(
|
|
|
|
applyMiddleware(
|
|
|
|
createLogger(),
|
|
|
|
promiseMiddleware(),
|
|
|
|
thunk
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
};
|