import { useShow, useGetList } from "@pankod/refine";
import { Show, Table } from "@pankod/refine";
import { Table as AntTable } from "antd";
const OrderShow = () => {
const { queryResult } = useShow();
const { data, isLoading } = queryResult;
const orderId = data?.data?.id;
const {
data: lineItemsData,
isLoading: lineItemsLoading,
} = useGetList({
resource: `orders/${orderId}/items`,
queryOptions: {
enabled: !!orderId,
},
});
const columns = [
{
title: 'Item Name',
dataIndex: 'name',
key: 'name',
},
{
title: 'Quantity',
dataIndex: 'quantity',
key: 'quantity',
},
// Add more columns as needed
];
return (
<Show isLoading={isLoading}>
{/* Display order details here */}
{lineItemsLoading ? (
"Loading line items..."
) : (
<Table dataSource={lineItemsData?.data} rowKey="id">
<AntTable columns={columns} />
</Table>
)}
</Show>
);
};
import { useShow, useGetList } from "@pankod/refine";
import { Show, Table } from "@pankod/refine";
import { Table as AntTable } from "antd";
const OrderShow = () => {
const { queryResult } = useShow();
const { data, isLoading } = queryResult;
const orderId = data?.data?.id;
const {
data: lineItemsData,
isLoading: lineItemsLoading,
} = useGetList({
resource: `orders/${orderId}/items`,
queryOptions: {
enabled: !!orderId,
},
});
const columns = [
{
title: 'Item Name',
dataIndex: 'name',
key: 'name',
},
{
title: 'Quantity',
dataIndex: 'quantity',
key: 'quantity',
},
// Add more columns as needed
];
return (
<Show isLoading={isLoading}>
{/* Display order details here */}
{lineItemsLoading ? (
"Loading line items..."
) : (
<Table dataSource={lineItemsData?.data} rowKey="id">
<AntTable columns={columns} />
</Table>
)}
</Show>
);
};