enlighten-qalb / src /components /Auth /PrivateRoute.jsx
eli02's picture
feat: Implement MainLayout component for consistent layout structure
3299552
raw
history blame contribute delete
334 Bytes
import React from 'react';
import { Navigate } from 'react-router-dom';
import { useAuth } from '../../hooks/useAuth';
const PrivateRoute = ({ children }) => {
const { isAuthenticated } = useAuth();
if (!isAuthenticated) {
return <Navigate to="/login" replace />;
}
return children;
};
export default PrivateRoute;