From 64a537425a05a15ecfac3bf314735876dbbd8ed7 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 14 Mar 2021 02:32:09 +0300 Subject: feat: pull Products from api --- src/components/DataTable.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/components/DataTable.tsx') diff --git a/src/components/DataTable.tsx b/src/components/DataTable.tsx index e75af18..e005454 100644 --- a/src/components/DataTable.tsx +++ b/src/components/DataTable.tsx @@ -9,12 +9,12 @@ interface Field { interface Props { title: string; - items: any[]; + items?: any[]; fields: Field[]; handleRowClick?: (index: number) => void; } -const DataTable: React.FC = ({ title, items, fields, handleRowClick = () => {} }) => { +const DataTable: React.FC = ({ title, items = [], fields, handleRowClick = () => {} }) => { return ( <>
@@ -22,6 +22,7 @@ const DataTable: React.FC = ({ title, items, fields, handleRowClick = ()
+ {items.length === 0 &&
No data
} ); }; -- cgit v1.2.3