27 lines
733 B
JavaScript
27 lines
733 B
JavaScript
|
import { createStore, applyMiddleware, combineReducers, compose } from 'redux'
|
||
|
import loginReducer from '../reducers/login'
|
||
|
import rootSaga from '../sagas/root'
|
||
|
import createSagaMiddleware from 'redux-saga'
|
||
|
import chatReducer from '../reducers/chat';
|
||
|
|
||
|
const sagaMiddleware = createSagaMiddleware()
|
||
|
|
||
|
const rootReducer = combineReducers({
|
||
|
user: loginReducer,
|
||
|
chat: chatReducer,
|
||
|
});
|
||
|
|
||
|
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
||
|
|
||
|
export function configureStore(initialState = {}) {
|
||
|
const store = createStore(
|
||
|
rootReducer,
|
||
|
initialState,
|
||
|
composeEnhancers(
|
||
|
applyMiddleware(sagaMiddleware)
|
||
|
)
|
||
|
)
|
||
|
sagaMiddleware.run(rootSaga);
|
||
|
return store;
|
||
|
}
|