Skip to content

Commit

Permalink
Merge pull request #377 from Aymanhki/ayman
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
Aymanhki authored Apr 9, 2024
2 parents 7b9279b + f0cb90b commit 91f0456
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions epoch_frontend/src/modules/ProtectedRoute.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { useContext } from 'react';
import { UserContext } from '../services/UserContext';


// Utility function to get the "epoch_session_id" cookie
export function getSessionCookie() {
Expand All @@ -21,8 +20,7 @@ const ProtectedRoute = ({ children }) => {
useEffect(() => {
// Check if the session is active; if not, redirect to the login page
if (!isSessionActive()) {
const { updateUser } = useContext(UserContext);
updateUser(null);

navigate('/epoch/login');
}
}, [navigate]);
Expand Down

0 comments on commit 91f0456

Please sign in to comment.