Skip to content

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

@crispyricepc

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 
     } 
   } 
 } 

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