Skip to content

Instantly share code, notes, and snippets.

@joe-crick
Created June 16, 2018 05:39
Show Gist options
  • Save joe-crick/0227822a1ddd355f948078486d9b845d to your computer and use it in GitHub Desktop.
Save joe-crick/0227822a1ddd355f948078486d9b845d to your computer and use it in GitHub Desktop.
// ****** 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