Function fetchApi

Fetches the data from the given endpoint and returns it.

The endpoint to fetch from.

The parameters to pass to the endpoint.

Any additional options to pass to fetch.

The response from the endpoint.

  • Fetches the data from the given endpoint and returns it.

    Type Parameters

    Parameters

    • endpoint: S

      The endpoint to fetch from.

    • params: ExtractParams<S>

      The parameters to pass to the endpoint.

    • OptionalrequestOptions: RequestOptions<R>

      Any additional options to pass to fetch.

    Returns Promise<R extends false
        ? ExtractResponse<S>
        : TypedJsonResponse<ExtractResponse<S>>>

    The response from the endpoint.

  • Fetches the data from the given endpoint and returns it.

    Type Parameters

    Parameters

    • endpoint: S & {
          parameters?: undefined;
      }

      The endpoint to fetch from.

    • Optionalparams: ExtractParams<S>

      Optional parameters to pass to the endpoint.

    • OptionalrequestOptions: RequestOptions<R>

      Any additional options to pass to fetch.

    Returns Promise<R extends false
        ? ExtractResponse<S>
        : TypedJsonResponse<ExtractResponse<S>>>

    The response from the endpoint.