antes de alterar login

This commit is contained in:
2026-05-26 16:40:01 +01:00
parent ef265ceeef
commit 3aa6e5468d
12 changed files with 316 additions and 92 deletions

View File

@@ -11,6 +11,7 @@ export default function AuthGuard({ children }: { children: React.ReactNode }) {
useEffect(() => {
if (!loading) {
// If user is not authenticated and not on a public page, redirect to login
if (!user && !pathname.startsWith("/login") && !pathname.startsWith("/register")) {
router.push("/login");
}
@@ -25,8 +26,8 @@ export default function AuthGuard({ children }: { children: React.ReactNode }) {
);
}
// Se não estiver logado e não estiver numa rota pública, não renderiza nada
// (o useEffect vai redirecionar)
// If not authenticated and not on a public page, don't render children
// (the useEffect will redirect)
if (!user && !pathname.startsWith("/login") && !pathname.startsWith("/register")) {
return null;
}