From 17a0393ce0cbca69b760af55b27c5926e66bbe6c Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Tue, 18 Sep 2018 12:56:42 -0700 Subject: [PATCH] disable upload button while uploading. fixes #927 --- app/pages/welcome/index.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/pages/welcome/index.js b/app/pages/welcome/index.js index 37f26a85..ffe60ba1 100644 --- a/app/pages/welcome/index.js +++ b/app/pages/welcome/index.js @@ -78,7 +78,7 @@ module.exports = function(state, emit) { @@ -91,6 +91,8 @@ module.exports = function(state, emit) { `; + function noop() {} + function dragover(event) { const div = document.querySelector('.uploadArea'); div.classList.add('uploadArea--dragging'); @@ -117,20 +119,22 @@ module.exports = function(state, emit) { } } - async function addFiles(event) { + function addFiles(event) { event.preventDefault(); const newFiles = Array.from(event.target.files); emit('addFiles', { files: newFiles }); } - async function upload(event) { + function upload(event) { event.preventDefault(); - - emit('upload', { - type: 'click', - dlimit: state.downloadCount || 1, - password: state.password - }); + event.target.disabled = true; + if (!state.uploading) { + emit('upload', { + type: 'click', + dlimit: state.downloadCount || 1, + password: state.password + }); + } } };