因此,我正在尝试使Apollo客户端与Apollo graphql服务器通信。将查询直接插入操场是完美的,但是当我从有角度的应用程序发送变异时。我收到不好的要求。我从组件订阅了该功能。
//Works perfectly in the playground
mutation {
createAwaitingSMS(
input:{
phoneNumber: "06706026221"
message: "Teszt message"
email: "mr.black@gmail.com"
name: "Mr.Gábor"
parameters: "Teszt Parameter"
link: 1
priority: 2
type: "Marketing"
order: 1
date: "2018.01.09"
campaign: 2
}
) {
id,
message,
email,
name
}
}
//Fails from the angular app
sendAwaitingSMS(data) {
const insertIntoQueue = gql`
mutation createAwaitingSMS($input: AwaitingSMSInput) {
createAwaitingSMS(input: $input) {
id
name
}
}
`;
return this.apollo.mutate({
mutation: insertIntoQueue,
variables: {
input: data
}
});
}