|
@@ -0,0 +1,26 @@
|
|
|
+import { connect, history } from 'umi';
|
|
|
+import { Button } from 'antd';
|
|
|
+import ProductList from '@/components/ProductList';
|
|
|
+
|
|
|
+const Products = ({ dispatch, products }) => {
|
|
|
+ function handleDelete(id) {
|
|
|
+ dispatch({
|
|
|
+ type: 'products/delete',
|
|
|
+ payload: id,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function goto() {
|
|
|
+ console.log(history.push('/'));
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <h2>List of Products</h2>
|
|
|
+ <Button onClick={e => goto()}>Button</Button>
|
|
|
+ <ProductList onDelete={handleDelete} products={products} />
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+export default connect(({ products }) => ({
|
|
|
+ products,
|
|
|
+}))(Products);
|