Using apollo-client
and graphql-tag
I'm trying to create a request something like:
gql`
{
data(
filter: ${options.filter}
sort: ${options.sort}
limit: ${options.limit}
offset: ${options.offset}
) {
name
}
}
`
However not all of these options are always set, sometimes I might only use limit and offset. But if I leave them unset I get Expected type Int, found undefined.
Should I loop through my options object beforehand and swap any undefined
values with null
? Or is there a better way to structure this?