Versions:
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:
Smartphone:
Additional context:
Works fine with Vee-validate version: 2.0.6.
duplicate of #1303
closed by 51bbc5dc2d803c6a25cb4bca2594aa07a6157ac3
Please release it
Most helpful comment
Please release it