Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 8c57f958

Přidáno uživatelem Václav Honzík před asi 2 roky(ů)

refactor to use Redux instead of localstate

re #9629

Zobrazit rozdíly:

frontend/src/features/TrackingTool/FileUpload.tsx
22 22
        file: yup.mixed().required('File is required'),
23 23
    })
24 24

  
25
    const [submitButtonEnabled, setSubmitButtonEnabled] = useState(true)
26

  
27 25
    const formik = useFormik({
28 26
        initialValues: {
29 27
            file: undefined,
30 28
        },
31 29
        validationSchema,
32 30
        onSubmit: async (values) => {
33
            // TODO actually send the file somewhere
34
            // TODO implement me
35

  
36
            const formData = new FormData()
37
            // @ts-ignore for now
38
            formData.append('file', values.file as File)
39

  
40
            const { data } = await axiosInstance.post('/path', formData, {
41
                headers: {
42
                    'Content-Type': 'multipart/form-data',
43
                },
44
            })
31
            
45 32
        },
46 33
    })
47 34

  

Také k dispozici: Unified diff