aboutsummaryrefslogblamecommitdiffstats
path: root/ui/app/store.js
blob: 3bafdee11c9ac659858b2eefb1fea218bfeaae1a (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                                                        
                                                      
                                         
                                                         
 
                                             
 

                               
                                       
                                         
  
 
                                                       
 
                                                                              
 
                                        

                                                             
const createStore = require('redux').createStore
const applyMiddleware = require('redux').applyMiddleware
const thunkMiddleware = require('redux-thunk').default
const rootReducer = require('./reducers')
const createLogger = require('redux-logger').createLogger

global.METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'

module.exports = configureStore

const loggerMiddleware = createLogger({
  predicate: () => global.METAMASK_DEBUG,
})

const middlewares = [thunkMiddleware, loggerMiddleware]

const createStoreWithMiddleware = applyMiddleware(...middlewares)(createStore)

function configureStore (initialState) {
  return createStoreWithMiddleware(rootReducer, initialState)
}