2016-04-14 00:28:44 +02:00
|
|
|
const createStore = require('redux').createStore
|
|
|
|
const applyMiddleware = require('redux').applyMiddleware
|
|
|
|
const thunkMiddleware = require('redux-thunk')
|
|
|
|
const rootReducer = require('./reducers')
|
2016-08-11 23:20:26 +02:00
|
|
|
const createLogger = require('redux-logger')
|
2016-04-14 00:28:44 +02:00
|
|
|
|
2016-08-12 03:58:23 +02:00
|
|
|
global.METAMASK_DEBUG = false
|
|
|
|
|
2016-04-14 00:28:44 +02:00
|
|
|
module.exports = configureStore
|
|
|
|
|
2016-08-12 03:58:23 +02:00
|
|
|
const loggerMiddleware = createLogger({
|
2016-08-12 04:04:50 +02:00
|
|
|
predicate: () => global.METAMASK_DEBUG,
|
2016-08-12 03:58:23 +02:00
|
|
|
})
|
2016-04-14 00:28:44 +02:00
|
|
|
|
2016-08-12 03:58:23 +02:00
|
|
|
const middlewares = [thunkMiddleware, loggerMiddleware]
|
2016-08-11 22:59:14 +02:00
|
|
|
|
2016-08-11 23:22:48 +02:00
|
|
|
const createStoreWithMiddleware = applyMiddleware(...middlewares)(createStore)
|
2016-04-14 00:28:44 +02:00
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function configureStore (initialState) {
|
2016-04-14 00:28:44 +02:00
|
|
|
return createStoreWithMiddleware(rootReducer, initialState)
|
|
|
|
}
|