perimeterx-axios-interceptor
Version:
🧱 Intercept requests which are blocked by PerimeterX - pop up the challenge and retry the request
35 lines (30 loc) • 937 B
TypeScript
import { AxiosInstance, AxiosError } from 'axios';
interface FilterOptions {
path?: string;
appId?: string;
[key: string]: any;
}
export interface PerimeterXInterceptorConfig {
filter?: (options: FilterOptions) => boolean;
onintercept?: (request: Request) => void;
onignore?: (request: Request) => void;
onsuccess?: (request: Request) => void;
onfailure?: (request: Request, error: AxiosError) => void;
onerror?: (error: AxiosError) => void;
simulate?: boolean;
modalConfig?: {
className?: string;
title?: string;
subtitle?: string;
quickfixes?: string[];
suffix?: string;
timeout?: number;
allowClose?: boolean;
compact?: boolean;
}
}
export declare const attach: (
axiosInstance: AxiosInstance,
config: PerimeterXInterceptorConfig
) => void;
export declare const detach: (axiosInstance: AxiosInstance) => void;