Skip to content

Commit

Permalink
Merge pull request #371 from DmytroAlipov/fix-import-grades-button-palm
Browse files Browse the repository at this point in the history
fix: file input handler
  • Loading branch information
cmltaWt0 committed Nov 16, 2023
2 parents 3644172 + facf1c8 commit 66bae17
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/GradesView/ImportGradesButton/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 66bae17

Please sign in to comment.