This commit is contained in:
41666 2021-03-14 18:32:40 -04:00
parent 3dda14e413
commit a99a6e7ffd
2 changed files with 7 additions and 16 deletions

View file

@ -30,7 +30,6 @@ export const AppRouter = () => {
<RouteWrapper component={ServersPage} path="/servers" />
<RouteWrapper component={PickerPage} path="/s/:serverID" />
<RouteWrapper component={MachineryNewSession} path="/machinery/new-session" />
<RouteWrapper
component={MachineryNewSession}
path="/machinery/new-session/:sessionID"

View file

@ -9,24 +9,16 @@ const NewSession = (props: { sessionID: string }) => {
const [postauthUrl, setPostauthUrl] = React.useState('/servers');
React.useEffect(() => {
const url = new URL(window.location.href);
const id = props.sessionID || url.searchParams.get('session_id');
if (id) {
localStorage.setItem('rp_session_key', id);
setupSession(props.sessionID);
}, [props.sessionID, setupSession]);
React.useEffect(() => {
const storedPostauthUrl = localStorage.getItem('rp_postauth_redirect');
if (storedPostauthUrl) {
setPostauthUrl(storedPostauthUrl);
localStorage.removeItem('rp_postauth_redirect');
}
}
}, [setPostauthUrl, props.sessionID]);
React.useEffect(() => {
if (props.sessionID) {
setupSession(props.sessionID);
}
}, [props.sessionID, setupSession]);
}, [setPostauthUrl]);
return (
<>