Skip to content

Instantly share code, notes, and snippets.

@ger86
Last active November 27, 2018 18:16
Show Gist options
  • Save ger86/55243dc2f138235970655ee86df12176 to your computer and use it in GitHub Desktop.
Save ger86/55243dc2f138235970655ee86df12176 to your computer and use it in GitHub Desktop.
export function getPostsThunk(params) {
return async dispatch => {
try {
const res = await dispatch(createRequest(getPosts(params)));
const posts = res.data;
dispatch({
type: GET_POSTS_SUCCEEDED,
payload: treasures
});
} catch (error) {
throw createApiError(error);
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment