Skip to content

Commit da1823a

Browse files
committed
fix schema mutation
1 parent 011af9f commit da1823a

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
import { useParams } from 'next/navigation';
13
import { graphql } from '@/gql';
24
import {
35
CreateFileResourceInput,
@@ -32,8 +34,6 @@ import { GraphQL } from '@/lib/api';
3234
import { Icons } from '@/components/icons';
3335
import { createResourceFilesDoc } from './ResourceDropzone';
3436
import { ResourceSchema, updateSchema } from './ResourceSchema';
35-
import { useParams } from 'next/navigation';
36-
import React from 'react';
3737

3838
interface TListItem {
3939
label: string;
@@ -106,15 +106,21 @@ export const EditResource = ({ reload, data }: any) => {
106106
const { mutate: modify } = useMutation(
107107
(data: { input: SchemaUpdateInput }) => GraphQL(updateSchema, data),
108108
{
109-
onSuccess: (data) => {
110-
console.log(data);
109+
onSuccess: () => {
110+
refetch();
111+
toast('Schema Updated Successfully', {
112+
action: {
113+
label: 'Dismiss',
114+
onClick: () => {},
115+
},
116+
});
111117
},
112118
onError: (err: any) => {
113119
console.log('Error ::: ', err);
114120
},
115121
}
116122
);
117-
123+
118124
const { mutate: transform } = useMutation(
119125
(data: { fileResourceInput: CreateFileResourceInput }) =>
120126
GraphQL(createResourceFilesDoc, data),
@@ -277,7 +283,7 @@ export const EditResource = ({ reload, data }: any) => {
277283
className=" w-1/5 justify-end"
278284
size="medium"
279285
kind="tertiary"
280-
variant="basic"
286+
variant="interactive"
281287
onClick={listViewFunction}
282288
>
283289
<div className="flex items-center gap-2">
@@ -385,7 +391,7 @@ export const EditResource = ({ reload, data }: any) => {
385391
/>
386392
<Combobox
387393
name="to_row_number"
388-
label="To Row Number"
394+
label="To Row Number"
389395
placeholder="Search Locations"
390396
list={[
391397
{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const ResourceSchema = ({
6464
}: any) => {
6565

6666
const transformedData = data.map((item: any) => ({
67-
schemaId: parseInt(item.id, 10),
67+
schemaId: item.id,
6868
format: item.format,
6969
description: item.description,
7070
}));
@@ -156,7 +156,7 @@ export const ResourceSchema = ({
156156
{
157157
accessorKey: 'format',
158158
header: 'FORMAT',
159-
cell: (info: any) => {
159+
cell: (info: any) => {
160160
const rowIndex = info.row.index;
161161
const format = updatedData[rowIndex]?.format || '';
162162
return (

0 commit comments

Comments
 (0)