Skip to content

Instantly share code, notes, and snippets.

@zzdjk6
Last active February 13, 2020 09:22
Show Gist options
  • Save zzdjk6/cfbe334a5d1f658ddb0133f02f637614 to your computer and use it in GitHub Desktop.
Save zzdjk6/cfbe334a5d1f658ddb0133f02f637614 to your computer and use it in GitHub Desktop.
const fetchData = getThunkActionCreator(
fetchDataRoutine,
async (id: number) => {
return await api.fetchData(id);
},
{
// this is optional
getRequestPayload: async (id: number) => {
return {
overwrittenPayload: id
};
},
// this is also optional
getFailurePayload: async (e: Error) => {
return new Error('Overwritten Error!');
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment