mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-04-12 02:38:15 +00:00
fix: add auth guard redirect and wire logout into NavAccountCard
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
12
src/components/layout/auth-guard.tsx
Normal file
12
src/components/layout/auth-guard.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Navigate, Outlet } from 'react-router';
|
||||
import { useAuth } from '@/providers/auth-provider';
|
||||
|
||||
export const AuthGuard = () => {
|
||||
const { isAuthenticated } = useAuth();
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return <Navigate to="/login" replace />;
|
||||
}
|
||||
|
||||
return <Outlet />;
|
||||
};
|
||||
Reference in New Issue
Block a user