MCPcopy
hub / github.com/marmelab/react-admin / handleSubmit

Function handleSubmit

packages/ra-no-code/src/ui/ImportResourceDialog.tsx:44–65  ·  view source on GitHub ↗
(event: FormEvent)

Source from the content-addressed store, hash-verified

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: {

Callers

nothing calls this directly

Calls 3

importResourceFunction · 0.85
handleCloseFunction · 0.70
navigateFunction · 0.50

Tested by

no test coverage detected