Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function App() {
<Router>
<ToastContainer autoClose={2000} position="top-center" newestOnTop />

<Layout setLoggedIn={setLoggedIn}>
<Layout loggedIn={loggedIn} setLoggedIn={setLoggedIn}>
<ScrollToTop/>

<Routes>
Expand Down
4 changes: 2 additions & 2 deletions client/src/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { useLocation } from 'react-router-dom';
import Header from './components/Header';
import Footer2 from './components/Footer2';

const Layout = ({ setLoggedIn,children }) => {
const Layout = ({ loggedIn, setLoggedIn,children }) => {
const location = useLocation();
const isAdminRoute = location.pathname === '/dashboard' || /^\/admin\/user\/[^\/]+$/.test(location.pathname);

return (
<>
{!isAdminRoute && <Header setLoggedIn={setLoggedIn}/>}
{!isAdminRoute && <Header loggedIn={loggedIn} setLoggedIn={setLoggedIn}/>}
{children}
{!isAdminRoute && <Footer2 />}
</>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ import leaf from "../assets/leaf.png";
import sun from "../assets/sun.png";
import moon from "../assets/moon.png"

function Header({ setLoggedIn }) {
function Header({ loggedIn, setLoggedIn }) {
const [logIn, setLogIn] = useState(false);
const navigate = useNavigate();
const [showMenu, setShowMenu] = useState(false);
Expand Down Expand Up @@ -136,7 +136,7 @@ const handleMenuClick = () => {
};

checkLoginStatus();
});
}, [loggedIn]);


const handleLogout = async () => {
Expand Down