fix define row to match with response
This commit is contained in:
@ -74,7 +74,7 @@ const ManageProviderContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
const columns = useMemo<ColumnDef<any>[]>(
|
const columns = useMemo<ColumnDef<any>[]>(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
accessorFn: (row) => row.id,
|
accessorFn: (row) => row.provider_id,
|
||||||
id: 'id',
|
id: 'id',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="ID" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="ID" column={column} />,
|
||||||
enableSorting: true,
|
enableSorting: true,
|
||||||
@ -84,7 +84,7 @@ const ManageProviderContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorFn: (row) => row.name,
|
accessorFn: (row) => row.provider_name,
|
||||||
id: 'name',
|
id: 'name',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Name" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Name" column={column} />,
|
||||||
enableSorting: true,
|
enableSorting: true,
|
||||||
@ -94,7 +94,7 @@ const ManageProviderContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorFn: (row) => row.description,
|
accessorFn: (row) => row.provider_description,
|
||||||
id: 'description',
|
id: 'description',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Description" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Description" column={column} />,
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
@ -104,7 +104,7 @@ const ManageProviderContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorFn: (row) => row.type,
|
accessorFn: (row) => row.provider_type,
|
||||||
id: 'type',
|
id: 'type',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Type" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Type" column={column} />,
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
@ -114,7 +114,7 @@ const ManageProviderContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorFn: (row) => row.status,
|
accessorFn: (row) => row.provider_status,
|
||||||
id: 'status',
|
id: 'status',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Status" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Status" column={column} />,
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
@ -134,13 +134,13 @@ const ManageProviderContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
className="btn btn-sm btn-icon btn-clear btn-light"
|
className="btn btn-sm btn-icon btn-clear btn-light"
|
||||||
onClick={() => handleEditDialog(true, row.id)}
|
onClick={() => handleEditDialog(true, row.provider_id)}
|
||||||
>
|
>
|
||||||
<KeenIcon icon="notepad-edit" />
|
<KeenIcon icon="notepad-edit" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className="btn btn-sm btn-icon btn-clear btn-light"
|
className="btn btn-sm btn-icon btn-clear btn-light"
|
||||||
onClick={() => handleDeleteDialog(true, row.id)}
|
onClick={() => handleDeleteDialog(true, row.provider_id)}
|
||||||
>
|
>
|
||||||
<KeenIcon icon="trash" />
|
<KeenIcon icon="trash" />
|
||||||
</button>
|
</button>
|
||||||
@ -168,7 +168,7 @@ const ManageProviderContextProvider = ({ children }: { children: React.ReactNode
|
|||||||
order_direction: sorting[0].desc == false ? 'ASC' : 'DESC',
|
order_direction: sorting[0].desc == false ? 'ASC' : 'DESC',
|
||||||
filter: JSON.stringify(filter)
|
filter: JSON.stringify(filter)
|
||||||
});
|
});
|
||||||
// console.log(response?.data);
|
console.log(response?.data);
|
||||||
setProvider(response?.data.list);
|
setProvider(response?.data.list);
|
||||||
return { data: response?.data.list, totalCount: response?.data.total_count };
|
return { data: response?.data.list, totalCount: response?.data.total_count };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user