Toggle navigation
Toggle navigation
This project
Loading...
Sign in
강동현
/
nodejs-game
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Overnap
2021-06-08 06:35:30 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0a3f911f42a8c08ab4b98850bdc679201cde2e65
0a3f911f
1 parent
d3f8ba63
Builds for 1 pipeline
failed
in 1 minute 18 seconds
비정상적인 루트로 방에 들어오면 로그인으로 강제 전송 추가
Changes
1
Builds
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
web/src/components/room/RoomInfo.tsx
web/src/components/room/RoomInfo.tsx
View file @
0a3f911
import React, { useCallback, useContext, useEffect, useState } from 'react';
import { use
Location, useParams
} from 'react-router';
import { use
History, useLocation
} from 'react-router';
import SocketContext from '../../contexts/SocketContext';
import { MessageResponse, MessageType, RawMessage } from '../common/types';
import { RoomData, UpdateRoomUser } from './types';
...
...
@@ -9,6 +9,7 @@ interface RoomInfoLocation {
}
export const RoomInfo: React.FC = () => {
const history = useHistory();
const socket = useContext(SocketContext);
const location: RoomInfoLocation = useLocation();
...
...
@@ -54,6 +55,12 @@ export const RoomInfo: React.FC = () => {
}, [roomData]);
useEffect(() => {
// 비정상적인 루트로 방을 들어오면 로그인 화면으로 푸시
if (location.state === undefined) {
history.push('/');
return;
}
setRoomData(location.state.roomData);
return () => {
...
...
Please
register
or
login
to post a comment