diff --git a/package.json b/package.json index 388cb43..9e71112 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tp/tp-dropzone", - "version": "2.0.0", + "version": "2.1.0", "description": "", "main": "tp-dropzone.js", "scripts": { diff --git a/tp-dropzone.js b/tp-dropzone.js index 33ec628..1c2523f 100644 --- a/tp-dropzone.js +++ b/tp-dropzone.js @@ -82,16 +82,15 @@ class TpDropzone extends upload(dropzoneMixin(LitElement)) { } } - async upload() { + async upload(data = null) { if (this.file) { - const params = { url: this.url, data: null }; document.dispatchEvent(new CustomEvent('before-upload', { - detail: params, + detail: { url: this.url, data }, bubbles: true, composed: true })); - await this.uploadFiles(params.url, [this.file], params.data); + await this.uploadFiles(this.url, [this.file], data); // Clear file after successful upload this.file = null;