2020-02-04 17:20:39 +01:00
|
|
|
import { createStore, applyMiddleware, combineReducers, compose } from 'redux'
|
|
|
|
import createSagaMiddleware from 'redux-saga'
|
2020-02-17 22:28:57 +01:00
|
|
|
import rootSaga from '../sagas/root'
|
2020-02-04 17:20:39 +01:00
|
|
|
|
|
|
|
const sagaMiddleware = createSagaMiddleware()
|
|
|
|
|
|
|
|
const rootReducer = combineReducers({
|
2020-02-17 22:28:57 +01:00
|
|
|
// Ajouter vos reducers ici
|
2020-02-04 17:20:39 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|