mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
fix(web): new-session should load a new page rather than fix state
This commit is contained in:
parent
42323a46f6
commit
fa85b30cf0
1 changed files with 9 additions and 2 deletions
|
@ -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 }) => {
|
|||
<div>
|
||||
<Link href={postauthUrl}>If you aren't redirected soon, click here.</Link>
|
||||
</div>
|
||||
{isAuthenticated && <Redirect to={postauthUrl} noThrow replace />}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue