From 35e459e77d5be05a83d413f5dc5c7be77aa2a755 Mon Sep 17 00:00:00 2001
From: Patrizio Bekerle <patrizio@bekerle.com>
Date: Wed, 22 Apr 2020 14:52:53 +0200
Subject: [PATCH] Implement alwaysSendFile attribute (VPU/Apps/Signature#4)

---
 packages/file-handling/src/fileupload.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/packages/file-handling/src/fileupload.js b/packages/file-handling/src/fileupload.js
index 45815334..f6451972 100644
--- a/packages/file-handling/src/fileupload.js
+++ b/packages/file-handling/src/fileupload.js
@@ -21,6 +21,7 @@ export class FileUpload extends ScopedElementsMixin(VPULitElement) {
         this.text = '';
         this.buttonLabel = '';
         this.uploadInProgress = false;
+        this.alwaysSendFile = false;
     }
 
     static get scopedElements() {
@@ -40,6 +41,7 @@ export class FileUpload extends ScopedElementsMixin(VPULitElement) {
             text: { type: String },
             buttonLabel: { type: String, attribute: 'button-label'},
             uploadInProgress: { type: Boolean, attribute: false},
+            alwaysSendFile: { type: Boolean, attribute: 'always-send-file'},
         };
     }
 
@@ -186,7 +188,7 @@ export class FileUpload extends ScopedElementsMixin(VPULitElement) {
             .then((response) => {
                 /* Done. Inform the user */
                 console.log(`Status: ${response.status} for file ${file.name}`);
-                this.sendFinishedEvent(response, file, response.status !== 201);
+                this.sendFinishedEvent(response, file, response.status !== 201 || this.alwaysSendFile);
             })
             .catch((response) => {
                 /* Error. Inform the user */
-- 
GitLab