Saltar al contenido principal

Function: useGet()

useGet<T>(apiName, endpointName, urlOptions?): Promise<FetchResult<T>>

Defined in: src/core/services/http.service.ts:407

GET helper over a registered API endpoint.

Type Parameters

T

T = unknown

Parameters

apiName

string

The registered API key.

endpointName

string

The endpoint key within the API.

urlOptions?

UrlOptions

Optional URL building options.

Returns

Promise<FetchResult<T>>

A FetchResult with data or error.

Example

import { useGet } from "katanakit-js";

const result = await useGet<{ name: string }>("pokeapi", "pokemonById", {
params: { id: 25 },
});