Showing
1 changed file
with
23 additions
and
0 deletions
front/src/Routes/Chat/ChatContainer.js
0 → 100644
| 1 | +import React from "react"; | ||
| 2 | +import { useSubscription, useMutation } from "@apollo/react-hooks"; | ||
| 3 | +import ChatPresenter from "./ChatPresenter"; | ||
| 4 | +import { withRouter } from "react-router-dom"; | ||
| 5 | +import { NEW_MESSAGE, SUBSCRIPTION_MSG } from "./ChatQueries"; | ||
| 6 | +import useInput from "../../Hooks/useInput"; | ||
| 7 | + | ||
| 8 | +export default withRouter(({ location }) => { | ||
| 9 | + const [createMsg] = useMutation(NEW_MESSAGE); | ||
| 10 | + const { | ||
| 11 | + data: { subMessage }, | ||
| 12 | + } = useSubscription(SUBSCRIPTION_MSG); | ||
| 13 | + | ||
| 14 | + const message = useInput(""); | ||
| 15 | + | ||
| 16 | + const onSubmit = async (e) => { | ||
| 17 | + e.preventDefault(); | ||
| 18 | + }; | ||
| 19 | + | ||
| 20 | + return ( | ||
| 21 | + <ChatPresenter location={location} message={message} onSubmit={onSubmit} /> | ||
| 22 | + ); | ||
| 23 | +}); |
-
Please register or login to post a comment