Skip to content

Instantly share code, notes, and snippets.

@mdboop
Created December 7, 2016 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdboop/15a0fda919bd8634f529357675448935 to your computer and use it in GitHub Desktop.
Save mdboop/15a0fda919bd8634f529357675448935 to your computer and use it in GitHub Desktop.
function epic(action$) {
return Observable.ofType('FETCH_FOO')
.mergeMap(() =>
ajax('/api/foos')
.map((data) => ({
type: 'FETCH_FOO_SUCCESS',
data,
}))
.catch((err) => [{
type: 'FETCH_FOO_ERROR',
err,
}]));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment