mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-25 03:49:11 +00:00
cd
This commit is contained in:
parent
3dda14e413
commit
a99a6e7ffd
2 changed files with 7 additions and 16 deletions
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
||||
const storedPostauthUrl = localStorage.getItem('rp_postauth_redirect');
|
||||
if (storedPostauthUrl) {
|
||||
setPostauthUrl(storedPostauthUrl);
|
||||
localStorage.removeItem('rp_postauth_redirect');
|
||||
}
|
||||
}
|
||||
}, [setPostauthUrl, props.sessionID]);
|
||||
setupSession(props.sessionID);
|
||||
}, [props.sessionID, setupSession]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (props.sessionID) {
|
||||
setupSession(props.sessionID);
|
||||
const storedPostauthUrl = localStorage.getItem('rp_postauth_redirect');
|
||||
if (storedPostauthUrl) {
|
||||
setPostauthUrl(storedPostauthUrl);
|
||||
localStorage.removeItem('rp_postauth_redirect');
|
||||
}
|
||||
}, [props.sessionID, setupSession]);
|
||||
}, [setPostauthUrl]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
Loading…
Add table
Reference in a new issue