The DELETE method is not supported for this route #797
Answered
by
ajnsn
stoneC0der
asked this question in
Help
-
"inertiajs/inertia-laravel": "^0.4.1", Hi, I am having hard time using inertia put/patch and delete method, when submitting the form, the action is successfully performed like, updating the record. this the code i am using: this.processing = true;
this.$inertia.patch(`/projects/${this.project.id}`, this.form).then(() => {
this.processing = false;
});
},```
as I understand, this might be the issue
"Note, when redirecting after a PUT, PATCH or DELETE request you must use a 303 response code, otherwise the subsequent request will not be treated as a GET request. A 303 redirect is the same as a 302 except that the follow-up request is explicitly changed to a GET request.
If you're using one of our official server-side adapters, redirects will automatically be converted."
But I am using the official server-side adapter, I tried setting the redirect code to 303 nothing, I even watch a video and the guy is also using the same code and no further configuration and it works as it should.
For now the solution is to use `post` and set the intended method in the method option, but I would like to know why it not working with `this.$inertia.patch`
WORK: when I put the `_method: patch` in the form object
this the code i am using:
```js updateProject () {
this.processing = true;
this.$inertia.post(`/projects/${this.project.id}`, this.form).then(() => {
this.processing = false;
});
},``` |
Beta Was this translation helpful? Give feedback.
Answered by
ajnsn
Jul 16, 2021
Replies: 1 comment 1 reply
-
@stoneC0der Yes, as you already figured out, you need to submit a |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
stoneC0der
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@stoneC0der Yes, as you already figured out, you need to submit a
POST
request with the_method
inside the payload. This is nothing related to Inertia, see comment over here.