blob: cb546862f28e65409e3d9eb0dfa539160a7c6316 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
const createStore = require('redux').createStore
const applyMiddleware = require('redux').applyMiddleware
const thunkMiddleware = require('redux-thunk')
const rootReducer = require('./reducers')
const developmentMode = require('../../app/scripts/config').developmentMode
const createLogger = require('redux-logger')
module.exports = configureStore
const middlewares = [thunkMiddleware]
if (developmentMode) {
console.log('Development Mode ON.')
const loggerMiddleware = createLogger()
middlewares.push(loggerMiddleware)
}
const createStoreWithMiddleware = applyMiddleware(...middlewares
)(createStore)
function configureStore (initialState) {
return createStoreWithMiddleware(rootReducer, initialState)
}
|