Created
May 22, 2019 17:26
-
-
Save Tiagoperes/f2c57a79b7eac5df66f9b8962d8dc5e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, applyMiddleware, combineReducers } from 'redux' | |
import createSagaMiddleware from 'redux-saga' | |
import resources from './resources' | |
import { createEffects } from '@zup-next/redux-resource' | |
const reducers = combineReducers({ | |
catalog: resources.catalog.reducers, | |
order: resources.order.reducers, | |
profile: resources.profile.reducers, | |
wallet: resources.wallet.reducers, | |
}) | |
const sagas = function* run() { | |
yield createEffects({ | |
...resources.catalog.sagas, | |
...resources.order.sagas, | |
...resources.profile.sagas, | |
...resources.wallet.sagas, | |
}) | |
} | |
const sagaMiddleware = createSagaMiddleware() | |
const store = createStore( | |
reducers, | |
applyMiddleware(sagaMiddleware), | |
) | |
sagaMiddleware.run(sagas) | |
export default store |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment