What happens
Qminder.graphql.subscribe(query) does not accept a second, optional argument for variables.
What should happen
Qminder.graphql.subscribe(query, variables) should accept a second, optional argument variables which it passes to the GQL_START message and sends to the backend: https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md#gql_start
Why
- It's best practice to send variables next to the query document, instead of injecting them with string interpolation
- Prevents GraphQL injections during runtime
- Makes writing complex or parameterized functions clearer
- Helps utilize modern tooling such as
graphql-tag which disallows string interpolation into queries
What happens
Qminder.graphql.subscribe(query)does not accept a second, optional argument forvariables.What should happen
Qminder.graphql.subscribe(query, variables)should accept a second, optional argumentvariableswhich it passes to theGQL_STARTmessage and sends to the backend: https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md#gql_startWhy
graphql-tagwhich disallows string interpolation into queries