11import { createStore , applyMiddleware , combineReducers , compose } from 'redux' ;
2+ import { hashHistory } from 'react-router' ;
3+ import { routerMiddleware , routerReducer as routing , push } from 'react-router-redux' ;
4+ import persistState from 'redux-localstorage' ;
25import thunk from 'redux-thunk' ;
36
4- import user from '../reducers/user' ;
5- import userActions from '../actions/user' ;
7+ import user from './reducers/user' ;
8+ import userActions from './actions/user' ;
9+
10+ const router = routerMiddleware ( hashHistory ) ;
611
712const actionCreators = {
8- ...userActions
13+ ...userActions ,
14+ push
915} ;
1016
1117const reducers = {
12- user
18+ user,
19+ routing
1320} ;
1421
15- const middlewares = [ thunk ] ;
22+ const middlewares = [ thunk , router ] ;
1623
1724const composeEnhancers = ( ( ) => {
1825 const compose_ = window && window . __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ;
@@ -22,9 +29,9 @@ const composeEnhancers = (() => {
2229 return compose ;
2330} ) ( ) ;
2431
25- const enhancer = composeEnhancers ( applyMiddleware ( ...middlewares ) ) ;
26- const rootReducer = combineReducers ( reducers ) ;
27-
2832export default function configureStore ( initialState ) {
33+ const enhancer = composeEnhancers ( applyMiddleware ( ...middlewares ) , persistState ( ) ) ;
34+ const rootReducer = combineReducers ( reducers ) ;
35+
2936 return createStore ( rootReducer , initialState , enhancer ) ;
3037}
0 commit comments