From fa85b30cf034723246894869651c3ccd12aab29a Mon Sep 17 00:00:00 2001 From: Katalina Okano Date: Sun, 14 Mar 2021 19:47:54 -0400 Subject: [PATCH] fix(web): new-session should load a new page rather than fix state --- packages/web/src/pages/machinery/new-session.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/web/src/pages/machinery/new-session.tsx b/packages/web/src/pages/machinery/new-session.tsx index 4cc009e..869e7a9 100644 --- a/packages/web/src/pages/machinery/new-session.tsx +++ b/packages/web/src/pages/machinery/new-session.tsx @@ -1,4 +1,3 @@ -import { Redirect } from '@reach/router'; import { Link } from '@roleypoly/design-system/atoms/typography'; import * as React from 'react'; import { useSessionContext } from '../../contexts/session/SessionContext'; @@ -16,6 +15,15 @@ const NewSession = (props: { sessionID: string }) => { } }, [setPostauthUrl]); + React.useEffect(() => { + if (isAuthenticated) { + setTimeout(() => { + window.history.replaceState(null, '', '/'); + window.location.href = postauthUrl; + }, 0); + } + }, [postauthUrl, isAuthenticated]); + React.useCallback( (sessionID) => { setupSession(sessionID); @@ -30,7 +38,6 @@ const NewSession = (props: { sessionID: string }) => {
If you aren't redirected soon, click here.
- {isAuthenticated && } ); };