sdy

remove useSubscription

import React, { useEffect } from "react";
import { useMutation, useQuery, useSubscription } from "@apollo/react-hooks";
import React from "react";
import { useMutation, useQuery } from "@apollo/react-hooks";
import ChatPresenter from "./ChatPresenter";
import { withRouter } from "react-router-dom";
import {
......@@ -15,9 +15,6 @@ export default withRouter(({ location }) => {
const { pathname } = location;
const roomName = pathname.slice(1, pathname.length);
const [createMsg] = useMutation(CREATE_MESSAGE);
const { data: subMessage } = useSubscription(SUBSCRIPTION_MSG);
console.log("subMessage : ", subMessage);
const message = useInput("");
......@@ -46,15 +43,12 @@ export default withRouter(({ location }) => {
messageArray = messageList;
}
let testObj;
testObj = subscribeToMore({
document: subMessage,
let resultObj = subscribeToMore({
document: SUBSCRIPTION_MSG,
updateQuery: (prev, { subscriptionData }) => {
console.log("prev : ", prev);
console.log("subscriptionData : ", subscriptionData);
if (!subscriptionData.data) return prev;
},
});
console.log(testObj);
const onSubmit = async (e) => {
e.preventDefault();
......@@ -75,8 +69,6 @@ export default withRouter(({ location }) => {
}
};
useEffect(() => {});
return (
<ChatPresenter
location={location}
......