Can't use graphQuery sortBy

I have a custom repeatable type called 'event'. I nee to grab a few fields for a listing page and my query is this:

{ allEvents{ edges{ nodes{ title state city logo uid date } } } }

and I want to do a sortBy on the date as such:

{ allEvents(sortBy:date_ASC){ edges{ nodes{ title state city logo uid date } } } }

the first query works, the second always gives me a CORS issue.

Any ideas? Also, it would be really great if your documentation for Vue/Nuxt had some examples of sorting and filtering.

Hey @sean1,

Thanks for posting this question, and welcome to the Prismic community :slight_smile:

Unlike GraphQL, GraphQuery does not accept arguments. If I understand correctly, your API query would fail (because the graphQuery syntax is invalid) and throw an HTTP error, probably 400: Bad Request. That could cause a CORS issue.

Having said that, I'm surprised that this GraphQuery option works for you at all. It looks like GraphQL syntax, rather than GraphQuery syntax.

In order to sort and filter with GraphQuery, you can use the regular Rest API sort and filter options, described here under Query Options.

Sam