Updated data table render check.

This commit is contained in:
Mike Cao 2024-05-07 23:09:19 -07:00
parent 3c27f08a97
commit 90bd72cf98
4 changed files with 27 additions and 2 deletions

View file

@ -1,16 +1,23 @@
import { useReports } from 'components/hooks';
import ReportsTable from './ReportsTable';
import DataTable from 'components/common/DataTable';
import { ReactNode } from 'react';
export default function ReportsDataTable({
websiteId,
teamId,
children,
}: {
websiteId?: string;
teamId?: string;
children?: ReactNode;
}) {
const queryResult = useReports({ websiteId, teamId });
if (queryResult?.result?.data?.length === 0) {
return children;
}
return (
<DataTable queryResult={queryResult}>
{({ data }) => <ReportsTable data={data} showDomain={!websiteId} />}