Created
October 8, 2017 04:22
-
-
Save vzaidman/4310a3ef09e9a8a66c0c608945930360 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 {composeReducers, makeReducer, makeAsyncReducer} from 'redux-toolbelt' | |
import { loadCustomers, loadOrders, loadProfile, changeUserName, logout } from './actions' | |
export default composeReducers( | |
{ | |
profile: makeAsyncReducer(loadProfile), | |
customers: makeAsyncReducer(loadCustomers), | |
orders: makeAsyncReducer(loadOrders) | |
}, | |
makeReducer(logout, (state, {type, payload}) => ({ | |
...state, | |
profile: { loading: false, data: null }, | |
customers: { loading: false, data: null }, | |
orders: { loading: false, data: null } | |
}) | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment