@@ -25,6 +25,7 @@ import { GraphQL } from '@/lib/api';
2525import { Icons } from '@/components/icons' ;
2626import { createResourceFilesDoc } from './DistributionList' ;
2727import { ResourceSchema } from './ResourceSchema' ;
28+ import { ResourceSchema } from './ResourceSchema' ;
2829
2930interface TListItem {
3031 label : string ;
@@ -35,8 +36,9 @@ interface TListItem {
3536}
3637
3738export const EditResource = ( { reload, data } : any ) => {
38- const params = useParams ( ) ;
3939
40+ const params = useParams ( ) ;
41+
4042 const updateResourceDoc : any = graphql ( `
4143 mutation updateFileResource($fileResourceInput: UpdateFileResourceInput!) {
4244 updateFileResource(fileResourceInput: $fileResourceInput) {
@@ -90,6 +92,25 @@ export const EditResource = ({ reload, data }: any) => {
9092 ( ) => GraphQL ( fetchSchema , { datasetId : params . id } )
9193 ) ;
9294
95+ const fetchSchema : any = graphql ( `
96+ query datasetSchema($datasetId: UUID!) {
97+ datasetResources(datasetId: $datasetId) {
98+ schema {
99+ id
100+ fieldName
101+ format
102+ description
103+ }
104+ id
105+ }
106+ }
107+ ` ) ;
108+
109+ const { data : payload , refetch, isLoading : isPending , } = useQuery < any > (
110+ [ `fetch_schema_${ params . id } ` ] ,
111+ ( ) => GraphQL ( fetchSchema , { datasetId : params . id } )
112+ ) ;
113+
93114 const { mutate : transform } = useMutation (
94115 ( data : { fileResourceInput : CreateFileResourceInput } ) =>
95116 GraphQL ( createResourceFilesDoc , data ) ,
0 commit comments