Skip to main content
Version: 2.x ๐Ÿšง

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 the requestFn
    • signal - An optional AbortSignal to cancel the request
    • meta - An optional object that will be passed to the requestFn
  1. 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' },
}
);