I am trying to sort some of my results but using a string the sortby is ignored.
query ($limit: Int!, $categoryId: Int) {
allAwards(first: $limit, orderBy: "DATE_DESC") {
edges {
{
"errors": [
{
"message": "Enum \"AwardsOrderBy\" cannot represent non-enum value: \"DATE_DESC\". Did you mean the enum value \"DATE_DESC\", \"DATE_ASC\", or \"IMAGES_DESC\"?",
"locations": [
{
"line": 2,
"column": 37
}
]
}
]
}
However if I use the enums it works:
allAwards(first: $limit, orderBy: DATE_DESC) {
But in my code, I do not have access to the enums in native JS. I do not use TS.
But then if I supply it as a string as a variable I get an error:
query ($limit: Int!, $categoryId: Int, $orderBy:[AwardInfosOrderBy!]) {
allAwards(first: $limit, orderBy: $orderBy) {
//variables
{
"orderBy": ["DATE_DESC"],
}
//error
{
"errors": [
{
"message": "Variable \"$orderBy\" of type \"[AwardInfosOrderBy!]\" used in position expecting type \"[AwardsOrderBy!]\".",
"locations": [
{
"line": 1,
"column": 40
},
{
"line": 2,
"column": 37
}
]
}
]
}