UsePost
katanakit-js / usePost
Function: usePost()
Section titled “Function: usePost()”function usePost<T>( apiName, endpointName, body?, urlOptions?): Promise<FetchResult<T>>;Defined in: core/services/http.service.ts:727
POST helper over a registered API endpoint.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
T |
unknown |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
apiName |
string |
The registered API key. |
endpointName |
string |
The endpoint key within the API. |
body? |
unknown |
Optional request body (auto-serialized to JSON unless raw). |
urlOptions? |
UrlOptions |
Optional URL building options. |
Returns
Section titled “Returns”Promise<FetchResult<T>>
A FetchResult with data or error.
Example
Section titled “Example”import { usePost } from "katanakit-js";
const result = await usePost("pokeapi", "createPokemon", { name: "Pikachu" });