我正在关注graphql上的教程(这里:https://www.howtographql.com/graphql-js/5-authentication/)并遇到嵌套输入的变异。我该如何编写相应的graphql-tag?
gql``
架构:
type Mutation {
createUser(name: String!, authProvider: AuthProviderSignupData!): User
}
###########
## Inputs
###########
input AuthProviderEmail {
email: String!
password: String!
}
input AuthProviderSignupData {
email: AuthProviderEmail
}
对应的graphiql输入:
mutation CreateUser {
createUser(name: "tester2", authProvider: {email: {email: "[email protected]", password: "password"}}) {
id
name
}
}
const mutation = gql`
mutation createUser($authProvider: AuthProviderSignupData!, $name: String!) {
createUser(authProvider: $authProvider, name: $name) {
id
}
}
`
const variables = {
"authProvider": {
"email": {
"email": "[email protected]",
"password": "123456789"
}
},
"name": "chakri",
}