POST, PUT, PATCH, DELETE
The method allows you to execute a Mutations without TanStack's QueryClient.
const result = qraft.<service>.<operation>(
{
parameters,
baseUrl,
signal,
meta,
},
requestFn
);
Argumentsโ
-
parameters: { path, query, header } | void
- Required only if OpenAPI specification defines required parameters
- If the operation has no required parameters according to OpenAPI, you can omit this argument
baseUrl
- An optional base URL for therequestFn
signal
- An optionalAbortSignal
to cancel the requestmeta
- An optional object that will be passed to therequestFn
requestFn?: RequestFn
- Optional, a function that will be used to execute the request
Returnsโ
result: Promise<T>
- The result of the query execution
Examplesโ
/**
* Executes the request:
* ###
* PATCH /posts/123
*
* { "title": "New title" }
**/
const posts = await qraft.posts.updatePost(
{
parameters: { path: { post_id: 123 } },
body: { title: 'New title' },
}
);