Documentation - v0.0.1
    Preparing search index...

    Interface GenericFetcher<OptionType>

    A generic interface for a fetcher function that can be used to make HTTP requests.

    const fetcher: GenericFetcher<{ headers: Record<string, string> }> = {
    fetch: async (url, method, body, options) => {
    const response = await fetch(url, { method, body, headers: options?.headers });
    if (!response.ok) {
    throw new Error(`HTTP error! status: ${response.status}`);
    }
    return response.json();
    },
    };
    interface GenericFetcher<
        OptionType extends Record<string, any> = Record<string, any>,
    > {
        fetch: <ResponseData = unknown>(
            url: string,
            method: HttpMethod,
            body?: string,
            options?: OptionType,
        ) => Promise<ResponseData>;
    }

    Type Parameters

    • OptionType extends Record<string, any> = Record<string, any>
    Index

    Properties

    Properties

    fetch: <ResponseData = unknown>(
        url: string,
        method: HttpMethod,
        body?: string,
        options?: OptionType,
    ) => Promise<ResponseData>