diff --git a/client/src/components/_common/Form/FileInputDropZone.jsx b/client/src/components/_common/Form/FileInputDropZone.jsx index d69c440dd..27f7946b4 100644 --- a/client/src/components/_common/Form/FileInputDropZone.jsx +++ b/client/src/components/_common/Form/FileInputDropZone.jsx @@ -45,27 +45,11 @@ function FileInputDropZone({ } }; - const handleClick = (index) => { - // rejectedFiles.splice(index, 1); - // setRejectedFiles(rejectedFiles); - // useState(setRejectedFiles(rejectedFiles)); - setRejectedFiles(rejectedFiles.splice(index, 1)); - setRejectedFiles(rejectedFiles); - }; - - // useEffect(() => { - // setRejectedFiles(rejectedFiles); - // console.log('useEffect'); - // }, [rejectedFiles]); - - const refreshRejectedFiles = () => { - setRejectedFiles(rejectedFiles); - } - // useEffect(refreshRejectedFiles, [rejectedFiles]); - - const removeRejectedFile = (index) => { - rejectedFiles.splice(index, 1); - // setRejectedFiles(rejectedFiles); + const removeRejectedFile = (i) => { + const newRejectedFiles = rejectedFiles.filter( + (file) => file !== rejectedFiles[i] + ); + setRejectedFiles(newRejectedFiles); }; const showFileList = (files && files.length > 0) || rejectedFiles.length > 0; @@ -100,18 +84,7 @@ function FileInputDropZone({