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:
2026-03-16 16:11:59 +05:30
parent 3b68605561
commit 8b796bf916
4 changed files with 46 additions and 21 deletions

View 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 />;
};