Sample JavaScript code that uses apollo-client on the frontend:
function getGql(newVersion) {
return gql`
mutation TestMutation(
$name: String!
${(newVersion)?`$format: Boolean`:``}
) {
testMutation(
name: $name
${(newVersion)?`format: $format`:``}
)
}
`;
}
Question: Can I interpolate gql-tag query so that the above method evaluates to either:
gql`
mutation TestMutation(
$name: String!
$format: Boolean
) {
testMutation(
name: $name
format: $format
)
}
`;
or:
gql`
mutation TestMutation(
$name: String!
) {
testMutation(
name: $name
)
}
`;
...based on the boolean parameter to getGql()?