@nuskin/axios-util

An Axios utility ...

Usage no npm install needed!

<script type="module">
  import nuskinAxiosUtil from 'https://cdn.skypack.dev/@nuskin/axios-util';
</script>

README

@nuskin/axios-util

axios-util allows you to use Axios in the exact same way you would use Axios by itself, with one exception. axios-util builds the retry and timeout resiliency patterns into Axios for you.

The default timeout has been set to 10000ms.

Retry has been implemented with the axios-retry module. All defaults of axios-retry are used except for retryDelay. retryDelay is set to axiosRetry.exponentialDelay

Installing

Usng npm:

npm add @nuskin/axios-util

Usng yarn:

yarn add @nuskin/axios-util

Example usage

const { axios } = require('@nuskin/axios-util')

// Now use axios as you normally would

Customizing retry

You can customize your retry logic by accessing axios-retry.

const { axios, axiosRetry } = require('@nuskin/axios-util')

// Custom retry delay
axiosRetry(axios, { retryDelay: (retryCount) => {
  return retryCount * 1000;
}})

Other possibilities for axios-util

Resources

  • Changelog could go here

License

MIT