sdy

update useQuery object destructuring

...@@ -17,14 +17,17 @@ export default withRouter(({ location }) => { ...@@ -17,14 +17,17 @@ export default withRouter(({ location }) => {
17 let messageObj, outcomingMsg, roomId; 17 let messageObj, outcomingMsg, roomId;
18 18
19 if (roomName !== undefined) { 19 if (roomName !== undefined) {
20 + const { data } = useQuery(GET_ROOM_BY_NAME, { variables: { roomName } });
20 const { 21 const {
21 - data: { getRoomByName }, 22 + getRoomByName: {
22 - } = useQuery(GET_ROOM_BY_NAME, { variables: { roomName } }); 23 + getRoomByName: { id: roomId },
23 - roomId = getRoomByName.id; 24 + },
25 + } = data;
26 + console.log(roomId);
24 } 27 }
25 28
26 const [createMsg] = useMutation(WHOLE_MESSAGE); 29 const [createMsg] = useMutation(WHOLE_MESSAGE);
27 - const { data } = useSubscription(SUBSCRIPTION_MSG); 30 + //const { data } = useSubscription(SUBSCRIPTION_MSG);
28 31
29 const message = useInput(""); 32 const message = useInput("");
30 33
......