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: { methods: {
async submitImage(e) { async submitImage(e) {
await this.dispatchStoreAction(storeActions.LOOKUP_VIN_BY_IMAGE, e.target.files[0]) await this.dispatchStoreAction(storeActions.LOOKUP_VIN_BY_IMAGE, e.target.files[0])
.then((response) => { .then(async (response) => {
document.getElementById(this.inputId).value = response.data; 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) => { .catch((error) => {
console.log(error); console.log(error);