I'm working on a GraphCMS site in React and would like to set up a GraphQL query to filter posts. We have this query setup which works and fetches all posts (adoptions) :
export const allAdoptions = gql`
query allAdoptions($first: Int!, $skip: Int!) {
allAdoptions(orderBy: date_DESC, first: $first, skip: $skip) {
id
name
date
image {
handle
}
desc
sex
species
neutered
},
_allAdoptionsMeta {
count
}
}
`
The code is available here : https://github.com/foxreymann/foranimals/blob/master/src/components/Adoptions.js
We'd like to set up a filter component to get posts by species: "Cat" for example, and we've tried just modifying the above query for species: "Cat" with no luck. Any advice much appreciated, thanks