Open
Description
openapi-react-query version
0.5.0
Description
The useMutation function is missing the Options parameter like in useQuery.
-
options
- The fetch options to use for the request.
- Only required if the OpenApi schema requires parameters.
- The options params are used as key. See Query Keys for more information.
This option parameter missing in useMutation and makes it impossible to pass path parameters to the types path.
Example:
api.useMutation("post", "/todos/{todo_id}/actions/delete");
Using template literal will throw an error because the path is typed.
Reproduction
Create a useMutation with path parameter and try to pass options. It is also missing in the docs so I guess this is not complicated to reproduce due to a completely missing feature. I would declare it as a bug because the function is currently not usable for urls with path parameters
Expected result
Add options
with path parameters to useMutation as an argument.
api.useMutation("post", "/todos/{todo_id}/actions/delete", {
params: {
path: {
todo_id,
},
},
});
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)