You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
719 B
24 lines
719 B
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)
|
|
}
|
|
|