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.
26 lines
761 B
26 lines
761 B
import { createStore, applyMiddleware, compose } from 'redux'
|
|
import thunk from 'redux-thunk'
|
|
import { createHashHistory } from 'history'
|
|
import { routerMiddleware } from 'connected-react-router'
|
|
import createRootReducer from '../reducers'
|
|
import ipc from '../reducers/ipc'
|
|
|
|
export const history = createHashHistory({ basename: window.location.pathname })
|
|
|
|
export function configureStore(initialState) {
|
|
const middleware = []
|
|
const enhancers = []
|
|
|
|
middleware.push(thunk)
|
|
|
|
// Router Middleware
|
|
const router = routerMiddleware(history)
|
|
middleware.push(router)
|
|
|
|
middleware.push(ipc)
|
|
|
|
enhancers.push(applyMiddleware(...middleware))
|
|
const enhancer = compose(...enhancers)
|
|
|
|
return createStore(createRootReducer(history), initialState, enhancer)
|
|
}
|
|
|