ChatQueries.js 617 Bytes
import { gql } from "apollo-boost";

export const SUBSCRIPTION_MSG = gql`
  subscription subMessage {
    subMessage {
      id
      text
      sender {
        id
        username
      }
      createdAt
    }
  }
`;

export const CREATE_MESSAGE = gql`
  mutation createMessage($message: String!, $roomId: Int!) {
    createMessage(message: $message, roomId: $roomId) {
      id
      text
      sender {
        id
        username
      }
      createdAt
    }
  }
`;

export const GET_ROOM_BY_NAME = gql`
  query getRoomByName($roomName: String!) {
    getRoomByName(roomName: $roomName) {
      id
    }
  }
`;