From 668c9f4841e7118b98bb31d8e68640689be99830 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 22 Aug 2020 13:54:56 +0300 Subject: refactor!: simplify file operations --- src/components/FileUpload/FileUpload.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/components') diff --git a/src/components/FileUpload/FileUpload.tsx b/src/components/FileUpload/FileUpload.tsx index d455f62..961fa9a 100644 --- a/src/components/FileUpload/FileUpload.tsx +++ b/src/components/FileUpload/FileUpload.tsx @@ -1,10 +1,9 @@ import React, { useRef } from 'react'; import Button from '@material-ui/core/Button'; import CloudUpload from '@material-ui/icons/CloudUpload'; -import { getLocalFileUrl } from '../../utils/files'; interface PropTypes { - callback: (fileUrl: string, file: File) => void; + callback: (file: File) => void; } @@ -13,10 +12,7 @@ const FileUpload: React.FC = ({ callback, children }) => { const handleChange = (event: React.ChangeEvent) => { const files = event.target?.files; - if (files?.length) { - const file = files[0]; - getLocalFileUrl(file).then(url => callback(url, file)); - }; + if (files?.length) callback(files[0]); }; const handleClick = () => { -- cgit v1.2.3