【发布时间】:2019-06-18 20:48:57
【问题描述】:
我正在尝试使用变异查询和 axios 发布名称为 city 的对象数据,但出现错误状态代码:400 Bad Request。
axios.post('http://localhost:5000/graphql/', {
query: `
mutation ($city:cityInput!) {
createCity (city:$city) {
id
cityName
}
}
`,
variables:
'{ "city": {"cityName": "test", "cityCode": "0001", "cityEnName": "test", "cityTwName": "test", "postCode": "0001", "provinceID": 1 }}',
})
.then(res => console.log(res))
.catch(err => console.log(err));
也许是因为我使用了对象数据?但我更喜欢使用对象数据。请帮助我,提前谢谢。
【问题讨论】: