blob: 30618e4f8c9362446dc5261320b471bb8a944a19 (
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
|
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)
}
|