Function useApiHandler

This function is a generic API handler that fetches data from a specified path using the Fetch API. It provides options for customizing the fetch request, handling loading state, aborting the request, and error handling.

  • Type Parameters

    • Data extends unknown = any

      The type of the data returned from the API

    Parameters

    • path: string

      The relative or absolute path to fetch from

    • options: IApiHandlerParams<Data> = {}

      An object containing optional configuration options for the API handler

    Returns OneHandler<Data, any>

    • The API handler function that can be invoked to make the request and retrieve the data