How to set a Relay variable as an enum value?

Viewed 1866

Example fragment:

fragments: {
  viewer: () => Relay.QL`
    fragment on Viewer {
      people(first: $limit orderBy: $orderBy) {
        count
        edges {
          node {
            id,
            ${PersonListItem.getFragment('person')},
          },
        },
      }
    }
  `,
},

The orderBy argument accepts the following enum values: firstNameASC/firstNameDESC/lastNameASC/lastNameDESC.

When doing this.setVariables({orderBy: 'firstName'}) the orderBy variable is passed as a string to the GraphQL server.

How do I pass any of these variables into Relay's setVariables without them being sent as strings?

1 Answers
Related