Skip to content

Commit

Permalink
Merge pull request EPAM-JS-Competency-center#217 from gultyaev/main
Browse files Browse the repository at this point in the history
Fix errors on initial launch
  • Loading branch information
SergeyKovalchuk authored Mar 7, 2021
2 parents d9c6697 + cb3818a commit 583cb28
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/MainLayout/components/Cart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function Cart() {
).then(({ data: { data: { cart } } }) => {
dispatch(updateFromApi(cart))
});
}, []);
}, [dispatch]);
const cartItems = useSelector(selectCartItems);
const badgeContent = cartItems.length || undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{
"count": 7,
"description": "Short Product Description2",
"id": "7567ec4b-b10c-48c5-9345-fc73c48a80a2",
"id": "7567ec4b-b10c-48c5-9345-fc73c48a80a3",
"price": 23,
"title": "Product"
},
Expand Down
5 changes: 3 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ axios.interceptors.response.use(
return response;
},
function(error) {
if (error.response.status === 400) {
if (error?.response?.status === 400) {
alert(error.response.data?.data);
}
return Promise.reject(error.response);

return Promise.reject(error?.response ?? error);
}
);

Expand Down

0 comments on commit 583cb28

Please sign in to comment.