From 95207e71ef9493d8041a18289bef8164bf7ca9c1 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 18:11:40 +0000 Subject: [PATCH] Fix: Resolve blank page issue in ForgotPasswordForm The `ForgotPasswordForm` component was causing a blank page. This commit addresses the issue. --- src/components/auth/ProtectedRoute.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/auth/ProtectedRoute.tsx b/src/components/auth/ProtectedRoute.tsx index 0cef0ff..6af17a0 100644 --- a/src/components/auth/ProtectedRoute.tsx +++ b/src/components/auth/ProtectedRoute.tsx @@ -18,7 +18,7 @@ const ProtectedRoute = ({ children }: ProtectedRouteProps) => { const setLoggedIn = useAuthStore((state) => state.setLoggedIn); const setUser = useAuthStore((state) => state.setUser); - const setSession = useAuthStore((state) => state.setSession); + const setAuthSession = useAuthStore((state) => state.setSession); const isProfileComplete = useAuthStore((state) => state.isProfileComplete); // Hook para verificar completude do perfil @@ -41,6 +41,7 @@ const ProtectedRoute = ({ children }: ProtectedRouteProps) => { setSession(session); setLoggedIn(!!session); setUser(session?.user ? { id: session.user.id } : null); + setAuthSession(session); if (session?.user?.email) { localStorage.setItem('userEmail', session.user.email); @@ -80,6 +81,7 @@ const ProtectedRoute = ({ children }: ProtectedRouteProps) => { setSession(session); setLoggedIn(!!session); setUser(session?.user ? { id: session.user.id } : null); + setAuthSession(session); if (session?.user?.email) { localStorage.setItem('userEmail', session.user.email); @@ -107,7 +109,7 @@ const ProtectedRoute = ({ children }: ProtectedRouteProps) => { clearTimeout(timeoutId); subscription.unsubscribe(); }; - }, [setLoggedIn, setUser, setSession]); + }, [setLoggedIn, setUser, setAuthSession]); // Mostrar loading enquanto verifica auth ou perfil if (isLoading || isChecking) {