Emit lookup error when no VINs are identified in image.

This commit is contained in:
Chloe Herd 2023-03-09 10:53:22 -05:00
parent ca7c10a65a
commit 5ef2c75016

View file

@ -133,12 +133,16 @@ export default {
this.isLoading = true;
await this.dispatchStoreAction(storeActions.LOOKUP_VIN_BY_IMAGE, e.target.files[0])
.then(async (response) => {
this.value = response.data.length > 0 ? response.data[0] : "";
if (response.data.length > 0) {
this.value = response.data[0];
// Wait for DOM to update before firing change event to handle validation.
await this.$nextTick();
// Wait for DOM to update before firing change event to handle validation.
await this.$nextTick();
document.getElementById(this.inputId).dispatchEvent(new Event("change"));
document.getElementById(this.inputId).dispatchEvent(new Event("change"));
} else {
this.$emit("imageLookupError");
}
})
.catch((error) => {
this.$emit("imageLookupError");