本文整理匯總了TypeScript中apollo-link.ApolloLink.concat方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ApolloLink.concat方法的具體用法?TypeScript ApolloLink.concat怎麽用?TypeScript ApolloLink.concat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類apollo-link.ApolloLink
的用法示例。
在下文中一共展示了ApolloLink.concat方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('does not update the cache on a mutation', () => {
let called = 0;
const inspector = new ApolloLink((operation, forward) => {
called++;
return forward(operation).map(result => {
called++;
return result;
});
});
const client = new ApolloClient({
link: inspector.concat(createMutationLink()),
cache: new InMemoryCache({ addTypename: false }),
});
return client
.query({ query })
.then(() =>
client.mutate({ mutation, variables, fetchPolicy: 'no-cache' }),
)
.then(() => {
return client.query({ query }).then(actualResult => {
expect(actualResult.data).toEqual(result);
});
});
});
示例2: constructor
constructor(apollo: Apollo, httpLink: HttpLink) {
apollo.create({
link: middlewareLink.concat(
httpLink.create({
uri: 'https://1jzxrj179.lp.gql.zone/graphql',
}),
),
cache: new InMemoryCache(),
});
}