phx-react
Version:
PHX REACT
15 lines (14 loc) • 444 B
TypeScript
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
interface ApiOptions {
method?: HttpMethod;
body?: any;
headers?: Record<string, string>;
params?: Record<string, any>;
}
export declare class ApiError extends Error {
status: number;
raw: any;
constructor(status: number, message: string, raw?: any);
}
export declare function apiFetch<T>(endpoint: string, options?: ApiOptions): Promise<T>;
export {};