Fix: Resolve blank page issue in ForgotPasswordForm
The `ForgotPasswordForm` component was causing a blank page. This commit addresses the issue.
This commit is contained in:
parent
3a1bc74f34
commit
95207e71ef
@ -18,7 +18,7 @@ const ProtectedRoute = ({ children }: ProtectedRouteProps) => {
|
|||||||
|
|
||||||
const setLoggedIn = useAuthStore((state) => state.setLoggedIn);
|
const setLoggedIn = useAuthStore((state) => state.setLoggedIn);
|
||||||
const setUser = useAuthStore((state) => state.setUser);
|
const setUser = useAuthStore((state) => state.setUser);
|
||||||
const setSession = useAuthStore((state) => state.setSession);
|
const setAuthSession = useAuthStore((state) => state.setSession);
|
||||||
const isProfileComplete = useAuthStore((state) => state.isProfileComplete);
|
const isProfileComplete = useAuthStore((state) => state.isProfileComplete);
|
||||||
|
|
||||||
// Hook para verificar completude do perfil
|
// Hook para verificar completude do perfil
|
||||||
@ -41,6 +41,7 @@ const ProtectedRoute = ({ children }: ProtectedRouteProps) => {
|
|||||||
setSession(session);
|
setSession(session);
|
||||||
setLoggedIn(!!session);
|
setLoggedIn(!!session);
|
||||||
setUser(session?.user ? { id: session.user.id } : null);
|
setUser(session?.user ? { id: session.user.id } : null);
|
||||||
|
setAuthSession(session);
|
||||||
|
|
||||||
if (session?.user?.email) {
|
if (session?.user?.email) {
|
||||||
localStorage.setItem('userEmail', session.user.email);
|
localStorage.setItem('userEmail', session.user.email);
|
||||||
@ -80,6 +81,7 @@ const ProtectedRoute = ({ children }: ProtectedRouteProps) => {
|
|||||||
setSession(session);
|
setSession(session);
|
||||||
setLoggedIn(!!session);
|
setLoggedIn(!!session);
|
||||||
setUser(session?.user ? { id: session.user.id } : null);
|
setUser(session?.user ? { id: session.user.id } : null);
|
||||||
|
setAuthSession(session);
|
||||||
|
|
||||||
if (session?.user?.email) {
|
if (session?.user?.email) {
|
||||||
localStorage.setItem('userEmail', session.user.email);
|
localStorage.setItem('userEmail', session.user.email);
|
||||||
@ -107,7 +109,7 @@ const ProtectedRoute = ({ children }: ProtectedRouteProps) => {
|
|||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
subscription.unsubscribe();
|
subscription.unsubscribe();
|
||||||
};
|
};
|
||||||
}, [setLoggedIn, setUser, setSession]);
|
}, [setLoggedIn, setUser, setAuthSession]);
|
||||||
|
|
||||||
// Mostrar loading enquanto verifica auth ou perfil
|
// Mostrar loading enquanto verifica auth ou perfil
|
||||||
if (isLoading || isChecking) {
|
if (isLoading || isChecking) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user