Giter Club home page Giter Club logo

Comments (8)

dschafer avatar dschafer commented on May 2, 2024

Just commented on the PR; the second argument to mutateAndGetPayload is a GraphQLResolveInfo, which should contain the rootValue in it.

Let me know if this solves the issue!

from graphql-relay-js.

dschafer avatar dschafer commented on May 2, 2024

Looks like this was resolved in the discussion on #16.

from graphql-relay-js.

spyalert01 avatar spyalert01 commented on May 2, 2024

@YourDeveloperFriend
I still don't understand How you get it solved?
I am trying to get the session value as well. and I also followed this : [express-graphql|https://github.com/graphql/express-graphql#advanced-options]

when my page is loaded, not even doing any mutation, from GraphQL I want to be able to access the value in my session, and from the session value, I want to do something.

How should I do it?

I tried this:

var queryType = new GraphQLObjectType({
name: 'Query',
fields: () => ({
node: nodeField,
// Add your own root fields here
viewer: {
type: userType,
resolve: ({rootValue}) => {
return getViewer();
},
},
}),
});

When the page is loaded, it says rootValue is undefined

from graphql-relay-js.

YourDeveloperFriend avatar YourDeveloperFriend commented on May 2, 2024
// It's possible your issue is this line:
// resolve: ({rootValue}) => {
// Try removing the brackets:
resolve: (rootValue) => {
  console.log(rootValue);
  console.log(arguments);
}

from graphql-relay-js.

spyalert01 avatar spyalert01 commented on May 2, 2024

Hi I have got it done
it should be resolve(parentValue, _, {rootValue:{session}})

Thanks.

from graphql-relay-js.

CoericK avatar CoericK commented on May 2, 2024

Hey @YourDeveloperFriend im trying to implement a login to, and i want to create the cooki inside the mutateAndGetPayload its that possible? so i can set res.cookie('token', 'mytokencreated'); @josephsavona any idea?

from graphql-relay-js.

prijindal avatar prijindal commented on May 2, 2024

The second argument does not seem to have a rootValue

from graphql-relay-js.

nikitindiz avatar nikitindiz commented on May 2, 2024

@prijindal the third one has, the second one is seems to be the request object.

from graphql-relay-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.