whale-plus
Version:
A Component Library for Vue 3
21 lines (20 loc) • 662 B
TypeScript
export interface RequestOptions {
url?: string;
baseUrl?: string;
params?: Record<string, any>;
data?: Record<string, any>;
headers?: Record<string, string>;
useCache?: boolean;
cache?: CacheOptions;
retry?: number;
retryInterval?: number;
}
export interface CacheOptions {
isPersist?: boolean;
duration?: number;
key?(config: RequestOptions): string;
isValid?(key: string, config: RequestOptions): boolean;
}
export type RequestOptionsType = (options: RequestOptions) => Promise<any>;
export declare const defaultRequestOptions: RequestOptions;
export declare function getDefaultCacheOptions(): CacheOptions;