mirror of
https://github.com/Sea-Haven-Industries/proposal-system.git
synced 2026-10-06 08:52:00 +00:00
13 lines
322 B
TypeScript
13 lines
322 B
TypeScript
|
|
import { Navigate } from 'react-router-dom';
|
||
|
|
import { useAuth } from '../hooks/useAuth';
|
||
|
|
|
||
|
|
export default function ProtectedRoute({ children }: { children: React.ReactNode }) {
|
||
|
|
const { isAuthenticated } = useAuth();
|
||
|
|
|
||
|
|
if (!isAuthenticated) {
|
||
|
|
return <Navigate to="/login" replace />;
|
||
|
|
}
|
||
|
|
|
||
|
|
return <>{children}</>;
|
||
|
|
}
|