sdy

update ChatContainer

...@@ -11,7 +11,6 @@ import { ...@@ -11,7 +11,6 @@ import {
11 import useInput from "../../Hooks/useInput"; 11 import useInput from "../../Hooks/useInput";
12 import { toast } from "react-toastify"; 12 import { toast } from "react-toastify";
13 13
14 -
15 export default withRouter(({ location }) => { 14 export default withRouter(({ location }) => {
16 const [messageArr, setMessageArr] = useState([]); 15 const [messageArr, setMessageArr] = useState([]);
17 const { pathname } = location; 16 const { pathname } = location;
...@@ -20,7 +19,7 @@ export default withRouter(({ location }) => { ...@@ -20,7 +19,7 @@ export default withRouter(({ location }) => {
20 19
21 const message = useInput(""); 20 const message = useInput("");
22 21
23 - let messageObj, roomNum, messageArray; 22 + let messageObj, roomNum, messageArray; // messageArray 는 useQuery 로 얻은 데이터 인데 undefined 가 아닌 데이터
24 23
25 const { data: getRoom } = useQuery(GET_ROOM_BY_NAME, { 24 const { data: getRoom } = useQuery(GET_ROOM_BY_NAME, {
26 variables: { roomName }, 25 variables: { roomName },
...@@ -36,7 +35,7 @@ export default withRouter(({ location }) => { ...@@ -36,7 +35,7 @@ export default withRouter(({ location }) => {
36 subscribeToMore, 35 subscribeToMore,
37 data: messageList, 36 data: messageList,
38 error: msgQueryError, 37 error: msgQueryError,
39 - loading: msgQueryyLoading, 38 + loading: msgQueryLoading,
40 } = useQuery(SEE_ALL_MESSAGE, { 39 } = useQuery(SEE_ALL_MESSAGE, {
41 variables: { roomId: roomNum }, 40 variables: { roomId: roomNum },
42 }); 41 });
...@@ -52,7 +51,7 @@ export default withRouter(({ location }) => { ...@@ -52,7 +51,7 @@ export default withRouter(({ location }) => {
52 if (messageArr) { 51 if (messageArr) {
53 setMessageArr(messageArr.seeAllMessage, [msgQueryError, messageArr]); 52 setMessageArr(messageArr.seeAllMessage, [msgQueryError, messageArr]);
54 } 53 }
55 - }, [msgQueryyLoading]); 54 + }, [msgQueryLoading]);
56 55
57 const subscribeToNewMessage = () => { 56 const subscribeToNewMessage = () => {
58 subscribeToMore({ 57 subscribeToMore({
......