Skip to content

Instantly share code, notes, and snippets.

@rudyhuynh
Last active January 27, 2018 10:41
Show Gist options
  • Save rudyhuynh/ec1060dce6a7fa504bb1d790e1d044ed to your computer and use it in GitHub Desktop.
Save rudyhuynh/ec1060dce6a7fa504bb1d790e1d044ed to your computer and use it in GitHub Desktop.
import flowRight from 'lodash.flowright'
import {onErrorRetryHOF} from './onErrorRetryHOF'
import {bypassCacheHOF} from './bypassCacheHOF'
export const myAppFetch = flowRight([
onErrorRetryHOF,
bypassCacheHOF,
// more higher-order fetch here
])(fetch) // <--- the original fetch
// usage (just like original fetch):
myAppFetch('https://my.api').then(/* ... */)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment