Skip to content
0

katanakit-js / useGet

Function: useGet() ​

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

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

GET helper over a registered API endpoint.

Type Parameters ​

Type ParameterDefault type
Tunknown

Parameters ​

ParameterTypeDescription
apiNamestringThe registered API key.
endpointNamestringThe endpoint key within the API.
urlOptions?UrlOptionsOptional URL building options.

Returns ​

Promise<FetchResult<T>>

A FetchResult with data or error.

Example ​

ts
import { useGet } from "katanakit-js";

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

Released under the MIT License.