0

In my React application I am using graphQL code generator for generating query and mutation React hooks (I am using Apollo client). Generated queries work just fine, but when it comes to mutation I am getting this error :

message: "Error trying to resolve field 'createSuborder'.", locations: [{line: 2, column: 3

Here is my important part of graphQL schema : enter image description here enter image description here

Weird thing is that when I try to run this mutation in graphQL playground it works. enter image description here

Here is my generated code from codegen, and hook used in my React component. enter image description here

  const [createSuborderMutation, { data, loading, error }] =
    useCreateSuborderMutation({
      variables: {
        tableId: 17,
        meals: [{ id: 1, count: 2 }],
        drinks: [{ id: 1, count: 3 }],
        token: "bpTtlPuC",
      },
    });
adammartiska
  • 35
  • 1
  • 4

0 Answers0