Builds for
1 pipeline
failed
in
1 minute 24 seconds
방 목록 수신에 문제가 있다면 로그인 화면으로 강제 전송 추가
Showing
1 changed file
with
4 additions
and
3 deletions
| 1 | import React, { useCallback, useContext, useEffect, useState } from 'react'; | 1 | import React, { useCallback, useContext, useEffect, useState } from 'react'; |
| 2 | +import { useHistory } from 'react-router'; | ||
| 2 | import { Main } from '../components/common/Main'; | 3 | import { Main } from '../components/common/Main'; |
| 3 | import { MessageResponse, MessageType, RawMessage } from '../components/common/types'; | 4 | import { MessageResponse, MessageType, RawMessage } from '../components/common/types'; |
| 4 | import { RoomBlock } from '../components/rooms/RoomBlock'; | 5 | import { RoomBlock } from '../components/rooms/RoomBlock'; |
| ... | @@ -6,6 +7,7 @@ import { Room } from '../components/rooms/types'; | ... | @@ -6,6 +7,7 @@ import { Room } from '../components/rooms/types'; |
| 6 | import SocketContext from '../contexts/SocketContext'; | 7 | import SocketContext from '../contexts/SocketContext'; |
| 7 | 8 | ||
| 8 | export const Rooms: React.FC = () => { | 9 | export const Rooms: React.FC = () => { |
| 10 | + const history = useHistory(); | ||
| 9 | const socket = useContext(SocketContext); | 11 | const socket = useContext(SocketContext); |
| 10 | const [ rooms, setRooms ] = useState<Room[]>([]); | 12 | const [ rooms, setRooms ] = useState<Room[]>([]); |
| 11 | 13 | ||
| ... | @@ -18,9 +20,8 @@ export const Rooms: React.FC = () => { | ... | @@ -18,9 +20,8 @@ export const Rooms: React.FC = () => { |
| 18 | if (response.ok) { | 20 | if (response.ok) { |
| 19 | setRooms(response.result!); | 21 | setRooms(response.result!); |
| 20 | } else { | 22 | } else { |
| 21 | - // TODO: 에러 핸들링 | 23 | + // 로그인하지 않고 방 목록으로 왔다고 판단 |
| 22 | - console.log("방 목록을 수신하지 못함"); | 24 | + history.push('/'); |
| 23 | - console.log(response); | ||
| 24 | } | 25 | } |
| 25 | }); | 26 | }); |
| 26 | }, []); | 27 | }, []); | ... | ... |
-
Please register or login to post a comment