Hi,
Struggling with a query on Apollo. I want to limit a result to the last 10 records from a postgres table. However I can’t even get the ‘limit’ to work. I assume I need to do something in the schema / resolvers too?
Here’s the code in my component:
// Define the graphql query to retrieve the adverts and the desired attributes
const allAdverts = gql`
query AdvertsForDisplay ( $limit: Int ) {
adverts ( limit: $limit ) {
id,
title,
slug,
type,
image,
content,
owner
}
}
`;
// Use the graphql container to run the allAdverts query
export default AdvertContainer = graphql( allAdverts, {
options() {
return {
variables: {
limit: 10,
},
pollInterval: 15000,
};
},
})( Adverts );
As always, any help is very much appreciated! I’m loving GraphQL so far but it takes a while to get your head around it I think
Cheers!