From c6ff82360199e955dc07d3fc32d5c75af6351c8c Mon Sep 17 00:00:00 2001 From: Arthur Belleville Date: Thu, 27 Mar 2025 09:07:38 +0100 Subject: [PATCH] Improve redirection when logging in with google --- ui/src/pages/oauth-signin.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/src/pages/oauth-signin.tsx b/ui/src/pages/oauth-signin.tsx index e822781..e8d6bbd 100644 --- a/ui/src/pages/oauth-signin.tsx +++ b/ui/src/pages/oauth-signin.tsx @@ -1,12 +1,17 @@ import { useEffect } from "react"; import { useNavigate } from "react-router-dom"; +import { useSession } from "../contexts/SessionContext"; export const OAuthSigninPage = () => { const navigate = useNavigate(); + const { session } = useSession(); useEffect(() => { - setTimeout(() => { - navigate("/"); + const interval = setInterval(() => { + if (session) { + navigate("/"); + } }, 100); - }, [navigate]); + return () => clearInterval(interval); + }, [navigate, session]); return <>; };