Skip to content

Commit cc1123a

Browse files
committed
refactor(ResourceDropzone): improve error handling and streamline imports
1 parent e3a85a4 commit cc1123a

File tree

1 file changed

+6
-7
lines changed
  • app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/resources/components

1 file changed

+6
-7
lines changed

app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/resources/components/ResourceDropzone.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import React from 'react';
2-
import { useParams, useSearchParams } from 'next/navigation';
3-
import { graphql } from '@/gql';
41
import { CreateFileResourceInput } from '@/gql/generated/graphql';
5-
import { useMutation, useQuery } from '@tanstack/react-query';
2+
import { useMutation } from '@tanstack/react-query';
63
import { parseAsString, useQueryState } from 'next-usequerystate';
7-
import { Button, DropZone, Text } from 'opub-ui';
4+
import { useParams } from 'next/navigation';
5+
import { Button, DropZone, Text, toast } from 'opub-ui';
6+
import React from 'react';
87

98
import { GraphQL } from '@/lib/api';
10-
import { bytesToSize } from '@/lib/utils';
119
import { createResourceFilesDoc } from './query';
1210

1311
export const ResourceDropzone = ({ reload }: { reload: () => void }) => {
@@ -36,7 +34,8 @@ export const ResourceDropzone = ({ reload }: { reload: () => void }) => {
3634
setResourceId(data.createFileResources[0].id);
3735
},
3836
onError: (err: any) => {
39-
console.log('Error ::: ', err);
37+
toast(err.message);
38+
setFile([]);
4039
},
4140
}
4241
);

0 commit comments

Comments
 (0)