vamp-utils
Version:
24 lines (23 loc) • 762 B
TypeScript
import { AxiosError, AxiosRequestConfig } from "axios";
export interface RequestConfig extends AxiosRequestConfig {
handleError?: boolean;
withoutPrincipal?: boolean;
[key: string]: any;
}
export interface ErrorHandler {
(error: AxiosError): Promise<never>;
}
export interface Interceptor<T> {
(value: T): T | Promise<T>;
}
export interface RequestOptions {
baseURL?: string;
apiSecret?: string;
getToken?: () => string | null;
getTokenExpire?: () => number;
onUnauthorized?: () => Promise<void> | void;
onForbidden?: () => Promise<void> | void;
errorHandler?: (message: string, error?: AxiosError) => void;
signRequest?: (config: RequestConfig) => RequestConfig;
statusMessage?: Record<number, string>;
}