(event: FormEvent)
| 42 | }; |
| 43 | |
| 44 | const handleSubmit = (event: FormEvent) => { |
| 45 | event.preventDefault(); |
| 46 | |
| 47 | if (resource && file) { |
| 48 | importResource(resource, file) |
| 49 | .then(({ resource, resourceAlreadyExists }) => { |
| 50 | handleClose(); |
| 51 | navigate(`/${resource}`); |
| 52 | |
| 53 | if (resourceAlreadyExists) { |
| 54 | // If we imported more records for an existing resource, |
| 55 | // we must refresh the list |
| 56 | queryClient.refetchQueries({ |
| 57 | queryKey: [resource, 'getList'], |
| 58 | }); |
| 59 | } |
| 60 | }) |
| 61 | .catch(() => { |
| 62 | notify('An error occured while handling this CSV file'); |
| 63 | }); |
| 64 | } |
| 65 | }; |
| 66 | |
| 67 | const { getRootProps, getInputProps } = useDropzone({ |
| 68 | accept: { |
nothing calls this directly
no test coverage detected