Skip to content

Instantly share code, notes, and snippets.

@komkanit
Last active November 10, 2017 15:19
Show Gist options
  • Save komkanit/ece4949591c351d7ec3a4267ad631b8a to your computer and use it in GitHub Desktop.
Save komkanit/ece4949591c351d7ec3a4267ad631b8a to your computer and use it in GitHub Desktop.
import ApolloClient from 'apollo-client';
import { ApolloLink } from 'apollo-link';
import { HttpLink } from 'apollo-link-http';
import { RetryLink } from 'apollo-link-retry';
import { InMemoryCache } from 'apollo-cache-inmemory';
const httpLink = new HttpLink({
uri: 'http://localhost:8080/graphql',
headers,
credentials: 'include',
});
const retry = new RetryLink();
const link = ApolloLink.from([
retry,
httpLink,
]);
// or
const link = ApolloLink.concat(retry, httpLink);
new ApolloClient({
link,
cache: new InMemoryCache(),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment