Overnap
Builds for 1 pipeline failed in 1 minute 18 seconds

비정상적인 루트로 방에 들어오면 로그인으로 강제 전송 추가

import React, { useCallback, useContext, useEffect, useState } from 'react';
import { useLocation, useParams } from 'react-router';
import { useHistory, 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 () => {
......