So in my code on axios...catch() I run:
this.$setLaravelValidationErrorsFromResponse({errors: error.response.data});
then I try to find the first element with error:
let firstInputWithErrors = document.querySelector('input.is-danger');
I do this because my inputs are in tabs and I want to open first tab in which validation failed.
However firstInputWithErrors is null unless i put it in a setTimeout() wrapper.
So to fix it I have:
setTimeout(() => {
let firstInputWithErrors = document.querySelector('input.is-danger');
//..do rest of my logic
}, 100);
Is there a nicer way to handle this?