Interface Ffetch<RequestMixin, ResponseMixin>

the main function of the library

interface Ffetch<RequestMixin, ResponseMixin> {
    delete: (
        url: string,
        params?: FfetchOptions & RequestMixin,
    ) => FfetchResult & ResponseMixin;
    extend: <
        const Addons extends FfetchAddon<any, any>[],
        Combined extends
            { request: object; response: object } = CombineAddons<Addons>,
    >(
        baseOptions: FfetchBaseOptions<Addons> & Combined["request"],
    ) => Ffetch<
        RequestMixin & Combined["request"],
        ResponseMixin & Combined["response"],
    >;
    get: (
        url: string,
        params?: FfetchOptions & RequestMixin,
    ) => FfetchResult & ResponseMixin;
    head: (
        url: string,
        params?: FfetchOptions & RequestMixin,
    ) => FfetchResult & ResponseMixin;
    options: (
        url: string,
        params?: FfetchOptions & RequestMixin,
    ) => FfetchResult & ResponseMixin;
    patch: (
        url: string,
        params?: FfetchOptions & RequestMixin,
    ) => FfetchResult & ResponseMixin;
    post: (
        url: string,
        params?: FfetchOptions & RequestMixin,
    ) => FfetchResult & ResponseMixin;
    put: (
        url: string,
        params?: FfetchOptions & RequestMixin,
    ) => FfetchResult & ResponseMixin;
    (
        url: string,
        params?: FfetchOptions & RequestMixin,
    ): FfetchResult & ResponseMixin;
}

Type Parameters

  • RequestMixin
  • ResponseMixin

Properties

delete: (
    url: string,
    params?: FfetchOptions & RequestMixin,
) => FfetchResult & ResponseMixin

shorthand for making a DELETE request

extend: <
    const Addons extends FfetchAddon<any, any>[],
    Combined extends
        { request: object; response: object } = CombineAddons<Addons>,
>(
    baseOptions: FfetchBaseOptions<Addons> & Combined["request"],
) => Ffetch<
    RequestMixin & Combined["request"],
    ResponseMixin & Combined["response"],
>

extend the base options with the given options

note: addons, middlewares and headers will be merged with the base options, the rest of the options will be overridden

get: (
    url: string,
    params?: FfetchOptions & RequestMixin,
) => FfetchResult & ResponseMixin

shorthand for making a GET request

head: (
    url: string,
    params?: FfetchOptions & RequestMixin,
) => FfetchResult & ResponseMixin

shorthand for making a HEAD request

options: (
    url: string,
    params?: FfetchOptions & RequestMixin,
) => FfetchResult & ResponseMixin

shorthand for making an OPTIONS request

patch: (
    url: string,
    params?: FfetchOptions & RequestMixin,
) => FfetchResult & ResponseMixin

shorthand for making a PATCH request

post: (
    url: string,
    params?: FfetchOptions & RequestMixin,
) => FfetchResult & ResponseMixin

shorthand for making a POST request

put: (
    url: string,
    params?: FfetchOptions & RequestMixin,
) => FfetchResult & ResponseMixin

shorthand for making a PUT request