Skip to content

Commit

Permalink
feat: (cherry-pick) add 404 route
Browse files Browse the repository at this point in the history
  • Loading branch information
jsapro committed Jan 10, 2024
1 parent b2c820d commit 7cbabd1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function App() {
</Route>
<Route path={URLS.AGREEMENT} element={<Agreement />} />
<Route path={URLS.DELIVERY_COND} element={<DeliveryConditions />} />
<Route path="/404" element={<NotFound />} />
<Route path="*" element={<NotFound />} />
</Routes>
</Layout>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/category/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Category: React.FC = () => {
setCategoryObj(data.results[0]?.category);
})
.catch(() => {
navigate('/упс');
navigate('/404');
})
.finally(() => {
setIsLoading(false);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/product/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Product: React.FC = () => {
.then((data) => setProductItem(data))
.catch((error) => {
console.log(error);
navigate('/упс');
navigate('/404');
});
api
.reviewsList(Number(id))
Expand All @@ -58,7 +58,7 @@ const Product: React.FC = () => {
.catch((err) => console.log(err));
} else {
console.log('ID is undefined');
navigate('/упс');
navigate('/404');
}
}, [id, navigate]);

Expand Down

0 comments on commit 7cbabd1

Please sign in to comment.