简体   繁体   English

如何在Angular 5中使用GET方法使用Apollo graphql查询

[英]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.

相关问题 如何使用Apollo客户端库创建带有angular参数的graphql查询 - How to create a graphql query with arguments in angular using apollo client library Apollo Angular Graphql,如何使用多个端点? - Apollo Angular Graphql, How to use multiple enpoints? 无法使用来自 Angular 的 Apollo 查询 graphql 端点 - Cannot query graphql endpoint using Apollo from Angular angular 中的apollo client for graphql 如何处理报错? - How to handle error using apollo client in angular for graphql? 使用 GraphQl 的 Apollo 客户端时如何在 watchQuery 中使用加载属性 - How to use the loading property in a watchQuery when using the Apollo client for GraphQl 使用 graphql 和 apollo 客户端刷新 angular 的令牌 - refresh token for angular using graphql and apollo client Apollo 客户端 Angular:如何将从查询中获得的数据作为参数传递给 graphql 中的另一个查询? - Apollo Client Angular: how to pass the data obtained from a query as an argument in another query in graphql? Angular graphql 与阿波罗 - Angular graphql with Apollo 如何使用 Kuzzle &amp; GraphQL &amp; Apollo &amp; Realtime - How to use Kuzzle & GraphQL & Apollo & Realtime 如何使用 Apollo Angular 测试查询、变异、订阅服务? - How cant test Query, Mutation, Subscription services using Apollo Angular?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM