Skip to content

[Frontend] Queries to get a conversation's messages fail #49

Description

@crispyricepc

Response JSON:

{
    "errors": [
        {
            "message": "Unknown argument 'conversationId' on field 'User.conversations'. Did you mean 'nConversations'?",
            "locations": [
                {
                    "line": 3,
                    "column": 53
                }
            ]
        }
    ]
}

The error looks to be in here:

const GET_MESSAGE = gql`
query MessagesByConversation(
$conversationId: Int!
$nMessages: Int!
$token: String!
$offset: Int!
) {
me(token: $token) {
conversations(
nConversations: 1
token: $token
conversationId: $conversationId
) {
id
messages(nMessages: $nMessages, offset: $offset) {
sender {
username
}
timestamp
revision
content
}
}
}
}
`;

We just missed an endpoint in the API, I'll add that now, but the correct way to do this when it's ready is:

query MessagesByConversation( 
   $conversationId: Int! 
   $nMessages: Int! 
   $token: String! 
   $offset: Int! 
 ) {
  conversation(conversationId: $conversationId, token: $token) { 
    id 
    messages(nMessages: $nMessages, offset: $offset) { 
      sender { 
        username 
      } 
      timestamp 
      revision 
      content 
     } 
   } 
 } 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions