Cherry-pick: Tie changes to validation flow

This commit is contained in:
Chloe Herd 2023-03-08 13:25:50 -05:00
parent f7b9b79cfb
commit f4eed79845

View file

@ -123,8 +123,15 @@ export default {
methods: {
async submitImage(e) {
await this.dispatchStoreAction(storeActions.LOOKUP_VIN_BY_IMAGE, e.target.files[0])
.then((response) => {
document.getElementById(this.inputId).value = response.data;
.then(async (response) => {
this.value = response.data.length > 0 ? response.data[0] : "";
// Wait for DOM to update before firing change event to handle validation.
await this.$nextTick();
document.getElementById(this.inputId).dispatchEvent(
new Event('change')
);
})
.catch((error) => {
console.log(error);