From 5d5eea7955dde6a4194f727d3429a093342d633e Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Tue, 22 Mar 2022 20:26:03 +0200 Subject: [PATCH] rudimentary feedback when uploading --- client/src/pages/Upload.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/src/pages/Upload.js b/client/src/pages/Upload.js index 3330266..7b9b9b6 100644 --- a/client/src/pages/Upload.js +++ b/client/src/pages/Upload.js @@ -1,5 +1,4 @@ import React, { useState } from "react"; -import { logout } from "../util/Util"; import '../css/Upload.css'; const Upload = () => { @@ -7,8 +6,9 @@ const Upload = () => { const [selectedFile, updateSelection] = useState(null); const [clipname, updateName] = useState(''); - const submit = async () => { + const submit = async ({target: button}) => { + button.disabled = true; const formData = new FormData(); formData.set('file', selectedFile, selectedFile.name); formData.set('name', clipname); @@ -21,6 +21,9 @@ const Upload = () => { credentials: 'include' }); + button.disabled = false; + updateSelection(null); + updateName(''); console.log(response); }; @@ -71,10 +74,7 @@ const Upload = () => { : ''} - -
- -
+ );