Skip to content

Commit 583cb28

Browse files
Merge pull request #217 from gultyaev/main
Fix errors on initial launch
2 parents d9c6697 + cb3818a commit 583cb28

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/components/MainLayout/components/Cart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function Cart() {
2121
).then(({ data: { data: { cart } } }) => {
2222
dispatch(updateFromApi(cart))
2323
});
24-
}, []);
24+
}, [dispatch]);
2525
const cartItems = useSelector(selectCartItems);
2626
const badgeContent = cartItems.length || undefined;
2727

src/components/pages/PageProducts/components/productList.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{
3131
"count": 7,
3232
"description": "Short Product Description2",
33-
"id": "7567ec4b-b10c-48c5-9345-fc73c48a80a2",
33+
"id": "7567ec4b-b10c-48c5-9345-fc73c48a80a3",
3434
"price": 23,
3535
"title": "Product"
3636
},

src/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ axios.interceptors.response.use(
1313
return response;
1414
},
1515
function(error) {
16-
if (error.response.status === 400) {
16+
if (error?.response?.status === 400) {
1717
alert(error.response.data?.data);
1818
}
19-
return Promise.reject(error.response);
19+
20+
return Promise.reject(error?.response ?? error);
2021
}
2122
);
2223

0 commit comments

Comments
 (0)