Skip to content

Commit 64eea06

Browse files
Sergey KovalchukSergey Kovalchuk
authored andcommitted
feat: Add static product list representation
1 parent 8ae4e3d commit 64eea06

File tree

2 files changed

+65
-5
lines changed

2 files changed

+65
-5
lines changed

src/components/pages/PageProducts/components/Products.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import Grid from '@material-ui/core/Grid';
77
import Typography from '@material-ui/core/Typography';
88
import {makeStyles} from '@material-ui/core/styles';
99
import {Product} from "models/Product";
10-
import axios from 'axios';
1110
import {formatAsPrice} from "utils/utils";
1211
import AddProductToCart from "components/AddProductToCart/AddProductToCart";
13-
import API_PATHS from "constants/apiPaths";
12+
// import axios from 'axios';
13+
// import API_PATHS from "constants/apiPaths";
14+
import productList from "./productList.json";
1415

1516
const useStyles = makeStyles((theme) => ({
1617
card: {
@@ -35,8 +36,9 @@ export default function Products() {
3536
const [products, setProducts] = useState<Product[]>([]);
3637

3738
useEffect(() => {
38-
axios.get(`${API_PATHS.bff}/product/available/`)
39-
.then(res => setProducts(res.data));
39+
// axios.get(`${API_PATHS.bff}/product/available/`)
40+
// .then(res => setProducts(res.data));
41+
setProducts(productList);
4042
}, [])
4143

4244
return (
@@ -65,4 +67,4 @@ export default function Products() {
6567
))}
6668
</Grid>
6769
);
68-
}
70+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[
2+
{
3+
"count": 4,
4+
"description": "Short Product Description1",
5+
"id": "7567ec4b-b10c-48c5-9345-fc73c48a80aa",
6+
"price": 2.4,
7+
"title": "ProductOne"
8+
},
9+
{
10+
"count": 6,
11+
"description": "Short Product Description3",
12+
"id": "7567ec4b-b10c-48c5-9345-fc73c48a80a0",
13+
"price": 10,
14+
"title": "ProductNew"
15+
},
16+
{
17+
"count": 7,
18+
"description": "Short Product Description2",
19+
"id": "7567ec4b-b10c-48c5-9345-fc73c48a80a2",
20+
"price": 23,
21+
"title": "ProductTop"
22+
},
23+
{
24+
"count": 12,
25+
"description": "Short Product Description7",
26+
"id": "7567ec4b-b10c-48c5-9345-fc73c48a80a1",
27+
"price": 15,
28+
"title": "ProductTitle"
29+
},
30+
{
31+
"count": 7,
32+
"description": "Short Product Description2",
33+
"id": "7567ec4b-b10c-48c5-9345-fc73c48a80a2",
34+
"price": 23,
35+
"title": "Product"
36+
},
37+
{
38+
"count": 8,
39+
"description": "Short Product Description4",
40+
"id": "7567ec4b-b10c-48c5-9345-fc73348a80a1",
41+
"price": 15,
42+
"title": "ProductTest"
43+
},
44+
{
45+
"count": 2,
46+
"description": "Short Product Descriptio1",
47+
"id": "7567ec4b-b10c-48c5-9445-fc73c48a80a2",
48+
"price": 23,
49+
"title": "Product2"
50+
},
51+
{
52+
"count": 3,
53+
"description": "Short Product Description7",
54+
"id": "7567ec4b-b10c-45c5-9345-fc73c48a80a1",
55+
"price": 15,
56+
"title": "ProductName"
57+
}
58+
]

0 commit comments

Comments
 (0)