diff --git a/frontend/src/Navbar.tsx b/frontend/src/Navbar.tsx index dc2d9a7..c43565c 100644 --- a/frontend/src/Navbar.tsx +++ b/frontend/src/Navbar.tsx @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import Button from './library/button'; import './index.css'; +import { useNavigate } from 'react-router-dom'; type NavbarProps = { isLoggedIn?: boolean; @@ -17,6 +18,8 @@ const Navbar: React.FC = ({ }) => { const [isOpen, setIsOpen] = useState(false); + const navigate = useNavigate(); + const toggleMenu = () => { setIsOpen(!isOpen); }; @@ -92,7 +95,7 @@ const Navbar: React.FC = ({ buttonSize="w-[170px] h-12" px="px-0" onClick={() => { - window.location.href = '/error'; + navigate('/error'); }} /> diff --git a/frontend/src/pages/Error.tsx b/frontend/src/pages/Error.tsx index d6d23c0..7853bfb 100644 --- a/frontend/src/pages/Error.tsx +++ b/frontend/src/pages/Error.tsx @@ -1,7 +1,9 @@ import ErrorImage from '../assets/tornCard.svg'; import Button from '../library/button'; +import { useNavigate } from 'react-router-dom'; function Error() { + const navigate = useNavigate(); return (
@@ -26,7 +28,7 @@ function Error() { buttonSize="w-80 h-12" className="border-4" rounded="rounded-full" - onClick={() => (window.location.href = '/')} + onClick={() => navigate('/')} />