From 5b6433cb1c8f4e3dee4ded13c563b50f6854a648 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 22 Mar 2023 14:16:57 -0400 Subject: [PATCH] More coherent use of await. --- .../textbox-question/textbox-question.vue | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/common-components/textbox-question/textbox-question.vue b/src/common-components/textbox-question/textbox-question.vue index 70b96aa1c..9690a6815 100644 --- a/src/common-components/textbox-question/textbox-question.vue +++ b/src/common-components/textbox-question/textbox-question.vue @@ -145,17 +145,15 @@ export default { this.isImageProcessing = true; - await this.imageQuestionSubmitHandler(file) - .then(async (response) => { - this.value = response; + try { + this.value = await this.imageQuestionSubmitHandler(file); - await this.$nextTick(); + await this.$nextTick(); - document.getElementById(this.inputId).dispatchEvent(new Event("change")); - }) - .catch((error) => { - this.$emit("imageLookupError"); - }); + document.getElementById(this.inputId).dispatchEvent(new Event("change")); + } catch (error) { + this.$emit("imageLookupError"); + } this.isImageProcessing = false; },