react-native-retriable-fetch
Quick and dirty wrapper around fetch API to allow retries
Table of Contents
Table of Contents
Install
Usage
Contribute
License
Install
$ npm install --save react-native-retriable-fetch
$ yarn add react-native-retriable-fetch
Usage
Use like you would normally use the fetch API. This module adds additional options:
retries (default: 1, Optional) - Number of retries to perform
delay: (default: undefined, Optional) - Delay between retry attempts
rejectCodes: (default: [], Optional) - Array of response status codes to trigger a retry
import fetch from 'react-native-retriable-fetch'
export default class Example extends Component {
componentDidMount () {
fetch('foobarbaz', {retries: 5, delay:2000, rejectCodes: [404]})
}
render() {
return (
)
}
}
Contribute
Contributions are welcome. Please open up an issue or create PR if you would like to help out.
Note: If editing the README, please conform to the standard-readme specification.
License
Licensed under the MIT License.