VS
Size: a a a
VS
L
L
L
L
L
TP
TP
const [addAuthor, { data }] = useMutation(ADD_AUTHOR)
const handleAdd = () => {
if (name && country && city) {
addAuthor({ variables: { name, country, city } })
} else {
console.log('Enter all fields')
}
}
export const ADD_AUTHOR = gql`
mutation addAuthor($name: String!, $country: String!, $city: String!) {
addAuthor(name: $name, country: $country, city: $city) {
name
country
city
}
}
`
addAuthor: {
type: AuthorType,
args: {
name: { type: new GraphQLNonNull(GraphQLString) },
country: { type: new GraphQLNonNull(GraphQLString) },
city: { type: new GraphQLNonNull(GraphQLString) },
},
resolve(_, { name }) {
const author = new Authors({ name, country, city })
return author.save()
}
},
ОЛ
ОЛ
RD
TP
ОЛ
ОЛ
TP
ОЛ
TP
TP
ОЛ