From 489cb3c6867b4d3f6fd61c29cb503a54443c76d4 Mon Sep 17 00:00:00 2001
From: Patrizio Bekerle <patrizio@bekerle.com>
Date: Mon, 30 Mar 2020 10:21:43 +0200
Subject: [PATCH] Also use upload indicator for re-uploading files (#1)

---
 src/vpu-signature-pdf-upload.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/vpu-signature-pdf-upload.js b/src/vpu-signature-pdf-upload.js
index c70e075..261a213 100644
--- a/src/vpu-signature-pdf-upload.js
+++ b/src/vpu-signature-pdf-upload.js
@@ -78,7 +78,6 @@ class SignaturePdfUpload extends VPUSignatureLitElement {
      */
     onFileUploadFinished(ev) {
         if (ev.detail.status !== 201) {
-            console.log(ev.detail);
             // this doesn't seem to trigger an update() execution
             this.errorFiles[Math.floor(Math.random() * 1000000)] = ev.detail;
             // this triggers the correct update() execution
@@ -166,10 +165,12 @@ class SignaturePdfUpload extends VPUSignatureLitElement {
      * @param file
      * @param id
      */
-    fileUploadClickHandler(file, id) {
-        this._("#file-upload").uploadFile(file);
+    async fileUploadClickHandler(file, id) {
+        this.uploadInProgress = true;
         this.errorFiles.splice(id, 1);
         this.errorFilesCount--;
+        await this._("#file-upload").uploadFile(file);
+        this.uploadInProgress = false;
     }
 
     static get styles() {
-- 
GitLab