Nuxt.js: Request failed with status code 422

Created on 8 Mar 2019  路  2Comments  路  Source: nuxt/nuxt.js

Version

v2.4.0

Reproduction link

[https://github.com/totski90/laravel-nuxt-front-end and the backend https://github.com/totski90/laravel-nux-back-end]

Steps to reproduce

When form validation failed, it will be redirected to the default error "Request failed with status code 422" instead of the server side validation returned.

What is expected ?

The expected returned should be the validation coming from the server which I handled on the form rendering if validation fails.

What is actually happening?

It happened that the returned error was the javascript default error

This bug report is available on Nuxt community (#c8787)
bug-report

Most helpful comment

can not use try catch with nuxt-auth?

await this.$auth.loginWith("local",{
                    data: this.form
                });

What to do in this case?

All 2 comments

Use try/catch around your axios calls and handle the error properly.

e.g. in https://github.com/totski90/laravel-nuxt-front-end/blob/master/pages/register.vue#L54

PS: This is not a problem related to Nuxt :relaxed:

can not use try catch with nuxt-auth?

await this.$auth.loginWith("local",{
                    data: this.form
                });

What to do in this case?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

o-alexandrov picture o-alexandrov  路  3Comments

vadimsg picture vadimsg  路  3Comments

msudgh picture msudgh  路  3Comments

uptownhr picture uptownhr  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments