Created
June 16, 2018 05:39
-
-
Save joe-crick/0227822a1ddd355f948078486d9b845d 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
// ****** Action ******** | |
import { asyncUpdate } from "reduxigen"; | |
export const getContacts = asyncUpdate( | |
"contacts", | |
(orgId, costCenter) => fetch(`https://jsonplaceholder.typicode.com/users?orgId=${orgId}&cc=${costCenter}`), | |
contacts => ({ | |
contacts | |
}) | |
); | |
// ****** Consuming Component ********* | |
componentDidMount () { | |
const { orgId, costCenter } = this.state | |
this.props.getContacts(orgId, costCenter); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment