[英]how to use apollo graphql query using GET method in angular 5
What is the query format to send the GET request using Apollo GraphQL in Angular5? 在Angular5中使用Apollo GraphQL发送GET请求的查询格式是什么?
I've used 我用过
this.querySubscription = this.apollo.watchQuery<any>({
query: gql`
query listSchemaAttributes($schemaDomain: String!) {
query listSchemaAttributes(schemaDomain: $schemaDomain) {
type
uniqueName
isList
}
}
`,
variables: {
schemaDomain: "abc",
},
})
.valueChanges
.subscribe(({data}) => {
this.currentUser = data.currentUser;
});
this request is sent as POST method when i check in network tab, but i need to send it as GET method. 当我在“网络”标签中签入时,此请求以POST方法发送,但我需要以GET方法发送。 Please help me out on this. 请帮助我。 Thanks 谢谢
You can use apollo-angular-link-http
and it's method
option to set it to GET 您可以使用apollo-angular-link-http
及其method
选项将其设置为GET
https://github.com/apollographql/apollo-angular/tree/master/packages/apollo-angular-link-http#options https://github.com/apollographql/apollo-angular/tree/master/packages/apollo-angular-link-http#options
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.