0.1.0-alpha.0 • Published 1 year ago

@axios-use/plugins v0.1.0-alpha.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@axios-use/plugins

Plugins for Axios

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);
configtypedefaultexplain
retrynumber-number of retries
retryDelaynumber1000millisecond of retry delay
axios({
  method: "get",
  url: "/api/users",
  /** number of retries */
  retry: 1,
  /** millisecond of retry delay @default 1000 */
  retryDelay: 1200,
});

License

MIT