當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript apollo-angular-link-http.HttpLink類代碼示例

本文整理匯總了TypeScript中apollo-angular-link-http.HttpLink的典型用法代碼示例。如果您正苦於以下問題:TypeScript HttpLink類的具體用法?TypeScript HttpLink怎麽用?TypeScript HttpLink使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了HttpLink類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

 constructor(apollo: Apollo, httpLink: HttpLink) {
   apollo.create({
     // By default, this client will send queries to the
     // `/graphql` endpoint on the same host
     link: httpLink.create({ uri: Meteor.absoluteUrl('/graphql') }),
     cache: new InMemoryCache(),
   });
 }
開發者ID:Urigo,項目名稱:angular-meteor,代碼行數:8,代碼來源:app.module.ts

示例2: constructor

 constructor(
   apollo: Apollo,
   httpLink: HttpLink
 ) {
   // create Apollo
   apollo.create({
     link: httpLink.create({ uri }),
     cache: new InMemoryCache()
   });
 }
開發者ID:ramanujprasad,項目名稱:ApolloAngularApp2,代碼行數:10,代碼來源:graphql.module.ts

示例3: constructor

 constructor(apollo: Apollo, httpLink: HttpLink) {
   apollo.create({
     link: middlewareLink.concat(
       httpLink.create({
         uri: 'https://1jzxrj179.lp.gql.zone/graphql',
       }),
     ),
     cache: new InMemoryCache(),
   });
 }
開發者ID:kamilkisiela,項目名稱:apollo-angular-lazy-modules,代碼行數:10,代碼來源:app.module.ts

示例4: constructor

  constructor(apollo: Apollo, httpLink: HttpLink) {

    const uri = 'https://api.graph.cool/simple/v1/cjc9v2j990b9p01991mc14n8e';
    const http = httpLink.create({ uri });

    apollo.create({
      link: http,
      cache: new InMemoryCache()
    });
  }
開發者ID:spencermefford,項目名稱:hackernews-angular-apollo,代碼行數:10,代碼來源:apollo.config.ts

示例5: constructor

 constructor(apollo: Apollo, httpLink: HttpLink, ngrxCache: NgrxCache) {
   apollo.create({
     // By default, this client will send queries to the
     // `/graphql` endpoint on the same host
     link: httpLink.create({
       uri: "/api"
     }),
     cache: ngrxCache.create({})
   });
 }
開發者ID:isaacmg410,項目名稱:decidim-monitor,代碼行數:10,代碼來源:app.module.ts

示例6: constructor

  constructor(
    apollo: Apollo,
    httpLink: HttpLink
  ) {
    const link = requestLink(
      httpLink.create({
        uri: environment.graphql.http,
        withCredentials: true
      })
    );

    apollo.create({
      link,
      cache: new InMemoryCache
    });
  }
開發者ID:apollostack,項目名稱:GitHunt-angular2,代碼行數:16,代碼來源:graphql.module.ts

示例7: constructor

  constructor(
    apollo: Apollo,
    httpLink: HttpLink
  ) {
    const link = requestLink(
      httpLink.create({
        uri: `http://${environment.url}/graphql`,
        withCredentials: true,
      })
    );

    apollo.create({
      link,
      cache: new InMemoryCache,
    });
  }
開發者ID:Timmahh,項目名稱:questionable-bets,代碼行數:16,代碼來源:graphql.module.ts

示例8: createApollo

export function createApollo(httpLink: HttpLink): any {
  return {
    cache: new InMemoryCache(),
    defaultOptions: {
      query: {
        errorPolicy: 'all',
        fetchPolicy: 'network-only'
      },
      watchQuery: {
        errorPolicy: 'ignore',
        fetchPolicy: 'network-only'
      }
    },
    link: httpLink.create({
      uri: 'https://jetcamer.com/graphql'
    })
  };
}
開發者ID:nnoumegni,項目名稱:jetcamer,代碼行數:18,代碼來源:app.module.ts

示例9: constructor

  constructor(apollo: Apollo, httpLink: HttpLink) {
    const http = httpLink.create({ uri: `${environment.apiAddress}/graphql` });

    const middleware = setContext(() => ({
      headers: new HttpHeaders().set(
        'Sandwich-Auth-Token',
        localStorage.getItem('token') || ''
      )
    }));

    const error = onError(({ networkError, graphQLErrors }) => {
      console.error(networkError);

      window.location.pathname = '/login';
    });

    const link = middleware.concat(error).concat(http);

    apollo.create({
      link,
      cache: new InMemoryCache({
        dataIdFromObject: (o: any) => {
          let key;
          switch (o.__typename) {
            case 'user':
              key = `${o.__typename}-${o.userId},`;
              break;
            case 'week':
              key = `${o.__typename}-${o.weekId},`;
              break;
            case 'weekUserLink':
              key = `${o.__typename}-${o.weekId}-${o.userId},`;
              break;
            default:
              key = `${o.__typename}-${o.id},`;
              break;
          }

          return key;
        }
      })
    });
  }
開發者ID:FraserKillip,項目名稱:SC2_WEB,代碼行數:43,代碼來源:app.module.ts

示例10: createApollo

export function createApollo(httpLink: HttpLink) {
  return {
    link: httpLink.create({uri}),
    cache: new InMemoryCache(),
  };
}
開發者ID:telerik,項目名稱:kendo-angular2,代碼行數:6,代碼來源:graphql.module.ts


注:本文中的apollo-angular-link-http.HttpLink類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。