Skip to content

Commit 52e08a0

Browse files
author
bhavabhuthi
committed
fix: merge issues
1 parent d930d31 commit 52e08a0

1 file changed

Lines changed: 12 additions & 31 deletions

File tree

  • app/[locale]/dashboard/organization/[organizationId]/dataset/[id]/edit/components

app/[locale]/dashboard/organization/[organizationId]/dataset/[id]/edit/components/EditResource.tsx

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
1-
import React from 'react';
2-
import { useParams, useRouter } from 'next/navigation';
31
import { graphql } from '@/gql';
42
import {
53
CreateFileResourceInput,
64
UpdateFileResourceInput,
75
} from '@/gql/generated/graphql';
8-
import { useMutation } from '@tanstack/react-query';
6+
import { useMutation, useQuery } from '@tanstack/react-query';
97
import { parseAsString, useQueryState } from 'next-usequerystate';
8+
import { useParams, useRouter } from 'next/navigation';
109
import {
1110
Button,
1211
Combobox,
1312
Dialog,
1413
Divider,
1514
DropZone,
1615
Icon,
17-
IconButton,
1816
Select,
1917
Text,
2018
TextField,
21-
toast,
19+
toast
2220
} from 'opub-ui';
21+
import React from 'react';
2322

24-
import { GraphQL } from '@/lib/api';
2523
import { Icons } from '@/components/icons';
24+
import { GraphQL } from '@/lib/api';
2625
import { createResourceFilesDoc } from './DistributionList';
2726
import { ResourceSchema } from './ResourceSchema';
28-
import { ResourceSchema } from './ResourceSchema';
2927

3028
interface TListItem {
3129
label: string;
@@ -36,9 +34,8 @@ interface TListItem {
3634
}
3735

3836
export const EditResource = ({ reload, data }: any) => {
39-
4037
const params = useParams();
41-
38+
4239
const updateResourceDoc: any = graphql(`
4340
mutation updateFileResource($fileResourceInput: UpdateFileResourceInput!) {
4441
updateFileResource(fileResourceInput: $fileResourceInput) {
@@ -73,23 +70,12 @@ export const EditResource = ({ reload, data }: any) => {
7370
}
7471
);
7572

76-
const fetchSchema: any = graphql(`
77-
query datasetSchema($datasetId: UUID!) {
78-
datasetResources(datasetId: $datasetId) {
79-
schema {
80-
id
81-
fieldName
82-
format
83-
description
84-
}
85-
id
86-
}
87-
}
88-
`);
89-
90-
const { data: payload, refetch, isLoading: isPending,} = useQuery<any>(
91-
[`fetch_schema_${params.id}`],
92-
() => GraphQL(fetchSchema, { datasetId: params.id })
73+
const {
74+
data: payload,
75+
refetch,
76+
isLoading: isPending,
77+
} = useQuery<any>([`fetch_schema_${params.id}`], () =>
78+
GraphQL(fetchSchema, { datasetId: params.id })
9379
);
9480

9581
const fetchSchema: any = graphql(`
@@ -106,11 +92,6 @@ export const EditResource = ({ reload, data }: any) => {
10692
}
10793
`);
10894

109-
const { data: payload, refetch, isLoading: isPending,} = useQuery<any>(
110-
[`fetch_schema_${params.id}`],
111-
() => GraphQL(fetchSchema, { datasetId: params.id })
112-
);
113-
11495
const { mutate: transform } = useMutation(
11596
(data: { fileResourceInput: CreateFileResourceInput }) =>
11697
GraphQL(createResourceFilesDoc, data),

0 commit comments

Comments
 (0)