Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutation response undefined #180

Open
ludgart opened this issue Dec 11, 2022 · 1 comment
Open

Mutation response undefined #180

ludgart opened this issue Dec 11, 2022 · 1 comment

Comments

@ludgart
Copy link

ludgart commented Dec 11, 2022

Hello,

I'm following the documentation page https://villus.logaretm.com/guide/mutations/#handling-errors but I'm receiving an undefined response from the mutation.

My method

    login(test) {
      const {execute} = useMutation(loginMutation);

      return execute({
        test: test,
      }).then((result) => {
        console.log("result", result);
      }).catch((error) => {
        console.error(error);
      });
    },

Response from the server

{"errors":[{"message":"test is invalid.","path":["login"],"extensions":{"code":"INTERNAL_SERVER_ERROR","exception":{"message":"test is invalid.","path":["login"],"stacktrace":["GraphQLError: test is invalid.","    at login (file:///****/AuthModule.js:113:17)","    at processTicksAndRejections (node:internal/process/task_queues:96:5)","    at async file:///***/@graphql-tools/batch-execute/index.mjs:354:36","    at async Promise.all (index 0)","    at async DataLoader.batchExecuteLoadFn [as _batchLoadFn] (file:///****/@graphql-tools/batch-execute/index.mjs:352:25)"]}}}],"data":null}

Result from the console

test {data: undefined, error: undefined}

Versions:

  • Villus: 2.0.1
  • Vue: 3.2.45
  • Vite: 4.0.0
  • NPM 8.1.4

Is this an issue or what I'm doing wrong?

Thanks in advance!

@logaretm
Copy link
Owner

Not sure what is going on here. Perhaps the server is wrapping the response object? Can you point me to the API if it is public?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants