mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
only finish auth flow when user is actually authenticated
This commit is contained in:
parent
5123fba74d
commit
fcaf3af875
1 changed files with 3 additions and 3 deletions
|
@ -7,7 +7,7 @@ import { useSessionContext } from '../../contexts/session/SessionContext';
|
|||
import { Title } from '../../utils/metaTitle';
|
||||
|
||||
const NewSession = () => {
|
||||
const { setupSession, sessionID } = useSessionContext();
|
||||
const { setupSession, sessionID, isAuthenticated } = useSessionContext();
|
||||
const [postauthUrl, setPostauthUrl] = React.useState('/servers');
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
@ -32,10 +32,10 @@ const NewSession = () => {
|
|||
setupSession(sessionToken);
|
||||
}
|
||||
|
||||
if (sessionID) {
|
||||
if (sessionID && isAuthenticated) {
|
||||
navigate(postauthUrl);
|
||||
}
|
||||
}, [sessionID, location, postauthUrl, setupSession, navigate]);
|
||||
}, [sessionID, location, postauthUrl, setupSession, navigate, isAuthenticated]);
|
||||
|
||||
return (
|
||||
<GenericLoadingTemplate>
|
||||
|
|
Loading…
Add table
Reference in a new issue