Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1008 Bytes

README.md

File metadata and controls

45 lines (32 loc) · 1008 Bytes

@axios-use/plugins

Plugins for Axios

Install

npm i @axios-use/plugins

Interceptors

Retry

A Axios interceptor to retry requests. Intercept AxiosError code ERR_NETWORK and ETIMEDOUT report errors, try to retry again.

import { retryInterceptorArgs } from "@axios-use/plugins";
// or
import retryInterceptorArgs from "@axios-use/plugins/retry";

axios.interceptors.response.use(...retryInterceptorArgs);
config type default explain
retry number - number of retries
retryDelay number 1000 millisecond of retry delay
axios({
  method: "get",
  url: "/api/users",
  /** number of retries */
  retry: 1,
  /** millisecond of retry delay @default 1000 */
  retryDelay: 1200,
});

License

MIT