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,10 +1,21 @@
import DataTable from 'components/common/DataTable';
import { useUsers } from 'components/hooks';
import UsersTable from './UsersTable';
import { ReactNode } from 'react';
export function UsersDataTable({ showActions }: { showActions?: boolean }) {
export function UsersDataTable({
showActions,
children,
}: {
showActions?: boolean;
children?: ReactNode;
}) {
const queryResult = useUsers();
if (queryResult?.result?.data?.length === 0) {
return children;
}
return (
<DataTable queryResult={queryResult}>
{({ data }) => <UsersTable data={data} showActions={showActions} />}