graphql-tag
graphql-tag copied to clipboard
Is it possible to create a gql document from an existing variable?
I want people to be able to put graphql queries into a text box and then run those queries against the GraphQL server.
So I have this: let mutation = await astra.getQuery();
and then I want to do this:
astra.client.mutate(mutation: gql{mutation}
)
Or some such. Any way to do this?
I got this far: let mutation = await astra.getQuery(); console.log(mutation) console.log(gql([mutation]))
Neither works. The string is:
mutation createTables { cavemen: createTable( keyspaceName: "workshop", tableName: "cavemen", partitionKeys: [{name: "lastname", type: {basic: TEXT}}], clusteringKeys: [{name: "firstname", type: {basic: TEXT}}], values: [ { name: "occupation", type: {basic: TEXT} } ] )}
It works fine when I pass it explicitly but I need the user to be able to copy/paste
Any updates on this?