Skip to content

Commit

Permalink
use Apollo docs styling for the gql var uppercase
Browse files Browse the repository at this point in the history
  • Loading branch information
maapteh committed Oct 10, 2020
1 parent 36045a3 commit bf54913
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions example/chat/src/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand All @@ -32,7 +32,7 @@ export const Room = ({ channel, name }) => {
// subscribe to more messages
useEffect(() => {
const subscription = subscribeToMore({
document: Subscription,
document: SUBSCRIPTION,
variables: {
channel,
},
Expand Down Expand Up @@ -102,7 +102,7 @@ export const Room = ({ channel, name }) => {

}

const Subscription = gql`
const SUBSCRIPTION = gql`
subscription MoreMessages($channel: String!) {
messageAdded(roomName:$channel) {
id
Expand All @@ -112,15 +112,15 @@ const Subscription = gql`
}
`;

const Query = gql`
const QUERY = gql`
query Room($channel: String!) {
room(name: $channel) {
messages { id text createdBy }
}
}
`;

const Mutation = gql`
const MUTATION = gql`
mutation sendMessage($text: String!, $channel: String!, $name: String!) {
post(text:$text, roomName:$channel, username:$name) { id }
}
Expand Down

0 comments on commit bf54913

Please sign in to comment.