import { type Readable } from "svelte/store"; import type { ApiError, UrlOptions } from "../../types/index.js"; /** Reactive state exposed by the {@link useRequest} factory (Svelte stores). */ export interface RequestState { data: Readable; error: Readable; loading: Readable; refetch: () => Promise; } /** * Svelte store factory that wraps KatanaKit's HTTP GET. Bridges the Safe * Result pattern to idiomatic Svelte stores and never throws on HTTP errors. * * Stale responses are ignored via a request version counter and AbortController; * in-flight requests are aborted on component destroy. * * @param apiName - Name of the registered API (see `useInitApis`). * @param endpointName - Name of the endpoint inside that API. * @param options - Optional `UrlOptions` (path/query params). * @returns Readable stores `{ data, error, loading }` plus `refetch`. * * @example * ```svelte * * * {#if $loading} *
Loading…
* {:else if $error} *
{$error.message}
* {:else} *
{$data?.name}
* {/if} * ``` */ export declare function useRequest(apiName: string, endpointName: string, options?: UrlOptions): RequestState; //# sourceMappingURL=fetch.d.ts.map