From bf5491364e91b40372ef9132bc68b9ec303c0a38 Mon Sep 17 00:00:00 2001 From: maapteh Date: Sat, 10 Oct 2020 21:43:16 +0200 Subject: [PATCH] use Apollo docs styling for the gql var uppercase --- example/chat/src/Room.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/example/chat/src/Room.js b/example/chat/src/Room.js index c38fd7eb031..7f9e58718fc 100644 --- a/example/chat/src/Room.js +++ b/example/chat/src/Room.js @@ -17,13 +17,13 @@ export const Room = ({ channel, name }) => { const messagesEndRef = useRef(null) const [ text, setText ] = useState(''); - const [ addMessage ] = useMutation(Mutation, { + const [ addMessage ] = useMutation(MUTATION, { onCompleted: () => { setText(''); } }); - const { loading, error, data, subscribeToMore } = useQuery(Query, { + const { loading, error, data, subscribeToMore } = useQuery(QUERY, { variables: { channel }, @@ -32,7 +32,7 @@ export const Room = ({ channel, name }) => { // subscribe to more messages useEffect(() => { const subscription = subscribeToMore({ - document: Subscription, + document: SUBSCRIPTION, variables: { channel, }, @@ -102,7 +102,7 @@ export const Room = ({ channel, name }) => { } -const Subscription = gql` +const SUBSCRIPTION = gql` subscription MoreMessages($channel: String!) { messageAdded(roomName:$channel) { id @@ -112,7 +112,7 @@ const Subscription = gql` } `; -const Query = gql` +const QUERY = gql` query Room($channel: String!) { room(name: $channel) { messages { id text createdBy } @@ -120,7 +120,7 @@ const Query = gql` } `; -const Mutation = gql` +const MUTATION = gql` mutation sendMessage($text: String!, $channel: String!, $name: String!) { post(text:$text, roomName:$channel, username:$name) { id } }