diff --git a/frontend/src/FrontDesk.jsx b/frontend/src/FrontDesk.jsx index 119f708872..832d805f19 100644 --- a/frontend/src/FrontDesk.jsx +++ b/frontend/src/FrontDesk.jsx @@ -52,7 +52,6 @@ export default function FrontDesk() { }; useEffect(() => { - getAllNotifications(); checkLoginStatus(); const intervalId = setInterval(() => { checkLoginStatus(); @@ -61,6 +60,12 @@ export default function FrontDesk() { return () => clearInterval(intervalId); }, []); + useEffect(() => { + if (isLoggedIn) { + getAllNotifications(); + } + }, [isLoggedIn]); + if (loading) return ; if (isLoggedIn) { diff --git a/frontend/src/UnAuthenticatedSwitch.jsx b/frontend/src/UnAuthenticatedSwitch.jsx index 701de7d5a0..60a4e1fcd7 100644 --- a/frontend/src/UnAuthenticatedSwitch.jsx +++ b/frontend/src/UnAuthenticatedSwitch.jsx @@ -1,15 +1,15 @@ import React from "react"; -import { Routes, Route } from "react-router-dom"; +import { Routes, Route, Navigate, useLocation } from "react-router-dom"; import Login from "./pages/Login"; import Footer from "./components/Footer"; import AlertBanner from "./components/AlertBanner"; import UnAuthenticatedAppHeader from "./components/UnAuthenticatedAppHeader"; -import NotFound from "./pages/errorPages/NotFound"; import Unauthorized from "./pages/errorPages/Unauthorized"; import Citation from "./pages/Citation"; export default function UnAuthenticatedSwitch({ showAlert, setShowAlert }) { const [header, setHeader] = React.useState(true); + const location = useLocation(); return (
@@ -41,10 +41,13 @@ export default function UnAuthenticatedSwitch({ showAlert, setShowAlert }) { element={} /> } /> - } /> + } /> } /> - } /> + } + />