Skip to content

Commit

Permalink
send to 404 if connecting to nonexistant room
Browse files Browse the repository at this point in the history
  • Loading branch information
jwyce committed Jun 19, 2021
1 parent 0364bad commit 7a88980
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/.eslintcache

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/src/components/game/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const Login: React.FC<LoginProps> = ({
<HeroParticles />

<Title size="large">Gungi.io</Title>
<Subtitle style={{ margin: '0' }}>v1.0.8</Subtitle>
<Subtitle style={{ margin: '0' }}>v1.0.8.1</Subtitle>
<img
src={accountIcon}
alt="account"
Expand Down
7 changes: 6 additions & 1 deletion client/src/pages/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ export const Game: React.FC<RouteComponentProps> = ({ history }) => {
fetch(`${process.env.REACT_APP_API_URL}/current_rooms`)
.then((response) => response.json())
.then((data) => {
if (data.find((x: any) => x.roomId === gameId)?.gameStarted) {
const room = data.find((x: any) => x.roomId === gameId);
if (!room) {
history.push('/NotFound');
return;
}
if (room.gameStarted) {
//@ts-ignore
socket.auth = { username, gameId };
socket.connect();
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const Home: React.FC<HomeProps> = ({ history }) => {
<Wrapper>
<HeroParticles />
<Title size="large">Gungi.io</Title>
<Subtitle style={{ margin: '0' }}>v1.0.8</Subtitle>
<Subtitle style={{ margin: '0' }}>v1.0.8.1</Subtitle>
<Subtitle>
"You should enjoy the little detours to the fullest. Because that's
where you'll find things more important than what you want." - Ging
Expand Down

0 comments on commit 7a88980

Please sign in to comment.