UNPKG

xior

Version:

A lite http request lib based on fetch with plugins support and similar API to axios.

26 lines (23 loc) 1.01 kB
import { c as XiorInterceptorRequestConfig, k as XiorError, a as XiorRequestConfig, e as XiorPlugin } from '../xior-D4BXsC0R.js'; type ErrorRetryOptions = { /** retry times, default: 2 */ retryTimes?: number; /** * Retry after milliseconds, default: 3000 * after first time error retry, retry interval */ retryInterval?: number | ((count: number, config: XiorInterceptorRequestConfig, error: XiorError) => number); /** * default: true, * it's useful because we don't want retry when the error because of token expired */ enableRetry?: boolean | ((config: XiorRequestConfig, error: XiorError) => boolean | undefined); onRetry?: (config: XiorRequestConfig, error: XiorError, count: number) => void; }; /** @ts-ignore */ declare module 'xior' { interface XiorRequestConfig extends ErrorRetryOptions { } } declare function xiorErrorRetryPlugin(options?: ErrorRetryOptions): XiorPlugin; export { ErrorRetryOptions, xiorErrorRetryPlugin as default };