From 8c1fbe41f8cc857c305ec63863d9051c24c43002 Mon Sep 17 00:00:00 2001 From: Lautaro Petaccio <1120791+LautaroPetaccio@users.noreply.github.com> Date: Thu, 11 Jan 2024 13:56:34 -0300 Subject: [PATCH] fix: Redirect to auth if no connection (#441) * fix: Redirect to auth if no connection * fix: Only add skip setup once --- src/components/start/Start.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/start/Start.tsx b/src/components/start/Start.tsx index a1691267..b6af65ee 100644 --- a/src/components/start/Start.tsx +++ b/src/components/start/Start.tsx @@ -17,7 +17,9 @@ import './Start.css' function getAuthURL() { var url = new URL(window.location.href) - url.searchParams.append('skipSetup', 'true') + if (!url.searchParams.has('skipSetup')) { + url.searchParams.append('skipSetup', 'true') + } return `/auth/login?redirectTo=${encodeURIComponent(url.toString())}` } @@ -41,7 +43,10 @@ export default function Start(props: Props) { }, [isConnecting]) useEffect(() => { - if (!isConnected && !isConnecting && initialized) { + if ( + (!isConnected && !isConnecting && initialized) || + localStorage.getItem('decentraland-connect-storage-key') === null + ) { window.location.replace(getAuthURL()) return }