Form goes to catch on 200 response
See original GitHub issueHello,
Probably yet another stupid question 😄
I’m able to validate and display the errors on the form.
However, after fixing the errors (entering the fields), and re-submitting the form, it still goes into the catch
callback. Yet in the network tab I see a 200 ok
reponse from laravel. And my resource is created correctly in the database.
I’m not sure why it doesn’t go into the then
callback.
this.form.post(route('api.page.page.store'))
.then(response => {
this.loading = false;
vm.$message({
type: 'success',
message: response.data.message
});
window.location = route('admin.page.page.index');
})
.catch(error => {
this.loading = false;
vm.$notify.error({
title: 'Error',
message: 'There are some errors in the form.'
});
});
Is there something else to do?
Thanks
Edit: even when entering the form correctly from the first time, ie it never went into the catch
callback, it stills goes into it, even though laravel returns a 200.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How do I navigate once I submit a form and receive a status of ...
I am expecting to have it navigate to the root route when I get a status 200 from the server, which I am...
Read more >200 OK - HTTP - MDN Web Docs
The HTTP 200 OK success status response code indicates that the request has succeeded. A 200 response is cacheable by default.
Read more >Microsoft forms shows error no of responses exceeded when ...
Microsoft forms shows error no of responses exceeded when reaches 200 ... get 1000 responses per form and now when it reaches 200...
Read more >HTTP Status Code 200: What Is the 200 "OK" Response?
An HTTP status code 200 means success. The client has requested documents from the server. The server has replied to the client and...
Read more >How to catch HTTP Client connector status code and errors ...
I am trying to do error handling against an HTTP Client Connector using a Try/Catch shape and a notify Shape.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
response.data
doesn’t exist here, causing an error.catch
is called when anything in thethen
chain goes wrong, not just when there’s an error in the promise itself.oh man, thanks! I didn’t know that catch also catches errors in
then
. 😄I expected
message: response.data.message
because another component (a delete component) does has that structure. Curious here it’s justresponse.message
instead.Thanks a lot for the help! 👍