Overnap
Builds for 1 pipeline failed in 1 minute 24 seconds

방 목록 수신에 문제가 있다면 로그인 화면으로 강제 전송 추가

import React, { useCallback, useContext, useEffect, useState } from 'react';
import { useHistory } from 'react-router';
import { Main } from '../components/common/Main';
import { MessageResponse, MessageType, RawMessage } from '../components/common/types';
import { RoomBlock } from '../components/rooms/RoomBlock';
......@@ -6,6 +7,7 @@ import { Room } from '../components/rooms/types';
import SocketContext from '../contexts/SocketContext';
export const Rooms: React.FC = () => {
const history = useHistory();
const socket = useContext(SocketContext);
const [ rooms, setRooms ] = useState<Room[]>([]);
......@@ -18,9 +20,8 @@ export const Rooms: React.FC = () => {
if (response.ok) {
setRooms(response.result!);
} else {
// TODO: 에러 핸들링
console.log("방 목록을 수신하지 못함");
console.log(response);
// 로그인하지 않고 방 목록으로 왔다고 판단
history.push('/');
}
});
}, []);
......