Skip to content

Commit

Permalink
game: Redirect to home if not logged in.
Browse files Browse the repository at this point in the history
  • Loading branch information
kuv2707 committed Jun 18, 2024
1 parent 7f1fa6a commit 2ba7684
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/src/contexts/GameContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ export const GameProvider = () => {
const backendUrl = process.env.REACT_APP_BACKEND_URL;

useEffect(() => {
if (!auth.isLoggedIn()) {
navigate('/');
toast.open({
message: 'Please login to continue',
color: 'error',
});
return;
}
const queryParams = new URLSearchParams(location.search);
const gameType = queryParams.get('type');
async function setupGame() {
Expand Down

0 comments on commit 2ba7684

Please sign in to comment.