@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);
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,
});