Closed ivanjeremic closed 4 years ago
It is all still super experimental, therefore anything could still change. Just trying out a lot right now.
See the new commit and this file: https://github.com/NeverNull/gatsby-apollo-wpgraphql-jwt-starter/blob/master/src/components/LoginForm.js#L9-L19
LoginInput comes from passing the input to the useMutation like:
const [loginUser, { data: loginData }] = useMutation(LOGIN_USER)
loginUser({
variables: {
input: {
clientMutationId: getUuid(),
username: fields.username,
password: fields.password,
},
},
})
Checkout Mutation docs of Apollo here: https://www.apollographql.com/docs/react/v3.0-beta/data/mutations/
I'm not sure why the mutation is looking like this, Where is
LoginInput!
coming from?From the wpgraphql-jwt docs, I see
authToken
is used but here in this Boilerplate notIf anyone can clarify this to me would be very thankful. Also, I hope to create a
.env.development
and putting myGRAPHQL_URL=https://mysite.com/graphql
is the correct way to do it in Gatsby.But I copied the Logic of this boilerplate into a CRA/Apollo app and I'm still not able to get a token.