UseBuildUrl
katanakit-js / useBuildUrl
Function: useBuildUrl()
Section titled “Function: useBuildUrl()”function useBuildUrl( apiName, endpointName, options?): string;Defined in: core/services/http.service.ts:623
Returns the URL of a registered endpoint without calling fetch.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
apiName |
string |
Registered API key (from defineApiConfig). |
endpointName |
string |
Endpoint key inside that API. |
options? |
UrlOptions |
params fills :placeholders, query becomes the search string. |
Returns
Section titled “Returns”string
The fully built URL.
Throws
Section titled “Throws”Unknown API, unknown endpoint, or a scheme that is not http(s).
Example
Section titled “Example”import { useBuildUrl } from "katanakit-js";
useBuildUrl("pokeapi", "pokemonById", { params: { id: 25 } });// → "https://pokeapi.co/api/v2/pokemon/25"