At the start of the server ( node index.js ) I get the following error with my GraphQL NodeJS server:
Error: Query.payment (data argument type :) should be an input type, but received: function GraphQLObjectType (config) {_classCallCheck (this, GraphQLObjectType);
This error occurred when I changed the original arguments from a string
args: { data: { type: graphQL.GraphQLString } },
To the type of object:
args: { data: { type: graphQL.GraphQLObjectType } },
I need an object type as I need to send several fields as parameters.
GraphQL Server:
var Query = new graphQL.GraphQLObjectType({ name: 'Query', fields: { payment: { type: graphQL.GraphQLString, args: { data: { type: graphQL.GraphQLObjectType } }, resolve: function (_, args) {
How can I allow him to accept an object?
Frontend (if necessary, but an error occurs before I even send this message):
var userQuery = encodeURIComponent('{ payment ( data: { user : "test" } )}'); $.get('http://localhost:4000/graphql?query=' + userQuery, function (res) {
source share