Vee-validate: Can't remove backend error messages

Created on 14 May 2018  路  2Comments  路  Source: logaretm/vee-validate

Versions:

  • vee-validate: 2.0.9
  • vue: 2.5.16

Describe the bug:
After updating from version 2.0.6 the backend errors can't be removed from errors array, for example, if backend error is "password is required" and user types a password, the validator doesn't remove any error and message.

To Reproduce:
Steps to reproduce the behavior:

User submit form (use Axios), the server (Laravel) validate form and set errors to Vue.

Example:

Server response:

{
    "message": "The given data was invalid.",
    "errors": {
        "username": ["The username field is required."],
        "password": ["The password field is required."]
    }
}

In Vue:

this.$axios({
    method: 'post',
    url: /login,
    data: this.form
}).then((response) => {
    console.log('Good');
}).catch((errors) => {
    let list = this.$master.hasErrors(errors) // validate error code = 422 and error message;
    if (list) {
        for (const key of Object.keys(list)) {
            if (list.hasOwnProperty(key)) {
                this.$validator.errors.add(key, list[key][0], key);
            }
        }
    }
});

Expected behavior:
While user write a password, the error field is removed

Demo Link:
With version 2.0.9:
JSFiddle

With version 2.0.6:
JSFiddle

Desktop:

  • OS: Windows 10
  • Browser: Chrome
  • Version: 66.0.3359.170

Smartphone:

  • Device: Galaxy Grand Prime
  • OS: Android 5.1.1
  • Browser: Stock
  • Version: 6.4.10.5

Additional context:
Works fine with Vee-validate version: 2.0.6.

duplicate

Most helpful comment

Please release it

All 2 comments

duplicate of #1303

closed by 51bbc5dc2d803c6a25cb4bca2594aa07a6157ac3

Please release it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Youdaman picture Youdaman  路  3Comments

jagasan picture jagasan  路  3Comments

DanielPe05 picture DanielPe05  路  3Comments

MeltedFreddo picture MeltedFreddo  路  3Comments

Shchepotin picture Shchepotin  路  3Comments