masdap
masdap

Reputation: 161

Graphql query argument not working

Hello guys i want to ask, so i have JSON response like this:

{
    "homeListComponents": [
        {
            "page": 1,
            "listComponents": [
                {
                    "componentName": "HEALTH_PRODUCT",
                    "componentDescription": "Showing health product component"
                },
                {
                    "componentName": "HEALTH_SERVICE",
                    "componentDescription": "Showing health service component"
                },
                {
                    "componentName": "OTHER_HEALTH_SERVICE",
                    "componentDescription": "Showing other health service component"
                }
            ]
        },
        {
            "page": 2,
            ...... //same like above
        },
        {
            "page": 3,
            ...... //same like above
        }
    ]
}

the response was successfully called in graphql using this query:

But, how can i call only page 1 ?

I already tried this query:

But the response is null.

Thank you.

Upvotes: 1

Views: 2354

Answers (1)

Lin Du
Lin Du

Reputation: 102672

You need implement your graphql resolver in server-side. It decide what result you will get.

In resolver function, your can get the arguments you passed from client.

For your question, I think you need implement a pagination

See these links:

https://graphql.org/learn/pagination/

https://www.apollographql.com/docs/react/features/pagination.html

https://github.com/mrdulin/apollo-server-express-starter/tree/master/src/pagination

Upvotes: 1

Related Questions