We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have an item previously returned by the api in the form:
{ id: 1, fieldA: 'abc', }
where the schema is defined as:
schema: { widgets: { type: 'widgets', fields: { fieldA: { type: 'string', readOnly: true, }, fieldB: 'string', } } }
I want to do a PATCH request which according to the docs Defaults to POST when creating a resource, and PATCH when updating.
Defaults to POST when creating a resource, and PATCH when updating
I am doing the following which is resulting in a POST instead of a PATCH.
POST
PATCH
const [patchWidget] = useMutation('widgets'); const submit = async (widget) => { widget.fieldB = new Date(); await patchWidget(widget)); }
What is the proper way to create a PATCH request without specifying it as an option in the mutation?
e.g. PATCH /api/widgets/1
PATCH /api/widgets/1
I was able to get it working with
const res = await client.mutate(['widgets', widget.id], { fieldB: new Date(), });
But will leave open because wondering if I need to use the client directly to get PATCH behavior
The text was updated successfully, but these errors were encountered:
@Holler the useMutation hook works the same as the client. This should work:
useMutation
const [patchWidget] = useMutation(['widgets', widget.id]);
Sorry, something went wrong.
@aribouius ah I see, thanks!
No branches or pull requests
I have an item previously returned by the api in the form:
where the schema is defined as:
I want to do a PATCH request which according to the docs
Defaults to POST when creating a resource, and PATCH when updating
.I am doing the following which is resulting in a
POST
instead of aPATCH
.What is the proper way to create a
PATCH
request without specifying it as an option in the mutation?e.g.
PATCH /api/widgets/1
edit
I was able to get it working with
But will leave open because wondering if I need to use the client directly to get PATCH behavior
The text was updated successfully, but these errors were encountered: