Skip to content

Instantly share code, notes, and snippets.

@joe-crick
Last active June 16, 2018 05:48
Show Gist options
  • Save joe-crick/cfe3788ff6b4993618507c46d9f84258 to your computer and use it in GitHub Desktop.
Save joe-crick/cfe3788ff6b4993618507c46d9f84258 to your computer and use it in GitHub Desktop.
const getContactById = contactId => fetch(`https://jsonplaceholder.typicode.com/contacts/${contact.id}`);
const setContactData = (data, state) => {
data.fullName = `${data.firstName} ${data.lastName}`
return {
currentContact: data,
actionSuccess: true,
masterContactAlert: data.contactId === state.masterContact.id
}
};
export const getContactById = asyncUpdate("getContactById", getContactById, setContactData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment