summaryrefslogtreecommitdiff
path: root/src/containers/Products.tsx
blob: 3542df13eb87c9d676ade986583119b73140a18c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import React from 'react';
import Page from '../containers/Page';
import ListTable from '../components/ListTable';
import { useProducts } from '../hooks/useAPIClient';

const fields = [
  { key: '_id', label: 'ID' },
  { key: 'name', label: 'Название' },
  { key: 'type', label: 'Тип' },
];

const actions = [
  { name: 'Добавить', route: 'products/add' }
];

const Home: React.FC = () => {
  const { data: products } = useProducts();

  return (
    <Page title="Товары" actions={actions}>
      <ListTable items={products} fields={fields} />
    </Page>
  );
};

export default Home;