import React from 'react'; import { useHistory } from 'react-router-dom'; import { Form, Formik } from 'formik'; import Button from '../../components/Button'; import Input from '../../components/Input'; import Page, { Action } from '../../containers/Page'; import { post } from '../../requests'; const TransfersUpload: React.FC = () => { const history = useHistory(); const handleSubmitFile = () => { const reader = new FileReader(); const element = document.getElementById('file') as HTMLInputElement; const file = element?.files?.[0]; if (file) { reader.readAsDataURL(file); reader.onload = (e: any) => { const uri = e.target.result; post('/uploads', { uri }).then(history.goBack); }; } }; const actions: Action[] = [ { name: 'Назад', variant: 'outlined', onClick: history.goBack }, { name: 'Загрузить', type: 'submit', form: 'form' }, ]; return (
); }; export default TransfersUpload;