diff options
author | eug-vs <eug-vs@keemail.me> | 2021-03-14 02:32:09 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2021-03-14 02:32:26 +0300 |
commit | 64a537425a05a15ecfac3bf314735876dbbd8ed7 (patch) | |
tree | 526d83464a470ee8311744b4736ae7545c0fcd30 /src/containers | |
parent | cfb287490d353166cf0a3db7105d8002cc473f00 (diff) | |
download | commercel-ui-64a537425a05a15ecfac3bf314735876dbbd8ed7.tar.gz |
feat: pull Products from api
Diffstat (limited to 'src/containers')
-rw-r--r-- | src/containers/Products.tsx | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/containers/Products.tsx b/src/containers/Products.tsx index 9b4f507..8cd301a 100644 --- a/src/containers/Products.tsx +++ b/src/containers/Products.tsx @@ -1,6 +1,7 @@ import React from 'react'; import Paper from '../components/Paper'; import DataTable from '../components/DataTable'; +import { useProducts } from '../hooks/useAPIClient'; const fields = [ { key: '_id', label: 'ID' }, @@ -8,19 +9,14 @@ const fields = [ { key: 'type', label: 'Тип' }, ]; -const items = [ - { _id: 1, name: 'Товар 1', type: 'Кондиционер' }, - { _id: 2, name: 'Товар 2', type: 'Кондиционер' }, - { _id: 3, name: 'Товар 3', type: 'Кондиционер' }, - { _id: 4, name: 'Товар 4', type: 'Кондиционер' }, - { _id: 5, name: 'Товар 5', type: 'Кондиционер' }, - { _id: 6, name: 'Товар 6', type: 'Кондиционер' }, -]; +const Home: React.FC = () => { + const { data: products } = useProducts(); -const Home: React.FC = () => ( - <Paper> - <DataTable title="Товары" items={items} fields={fields} /> - </Paper> -); + return ( + <Paper> + <DataTable title="Товары" items={products} fields={fields} /> + </Paper> + ); +}; export default Home; |