Compare commits

...

2 Commits

Author SHA1 Message Date
Max Sokolski
66bae174dd Merge pull request #371 from DmytroAlipov/fix-import-grades-button-palm
fix: file input handler
2023-11-16 11:40:53 +02:00
alipov_d
facf1c8866 fix: file input handler
hasFile run only once, it will always be null
2023-10-27 18:14:39 +03:00

View File

@@ -6,11 +6,10 @@ export const useImportButtonData = () => {
const submitImportGradesButtonData = thunkActions.grades.useSubmitImportGradesButtonData();
const fileInputRef = useRef();
const hasFile = fileInputRef.current && fileInputRef.current.files[0];
const handleClickImportGrades = () => hasFile && fileInputRef.current.click();
const handleClickImportGrades = () => fileInputRef.current?.click();
const handleFileInputChange = () => {
if (hasFile) {
if (fileInputRef.current?.files[0]) {
const clearInput = () => {
fileInputRef.current.value = null;
};