How to use the apollo-link-http function in apollo-link-http

To help you get started, we’ve selected a few apollo-link-http examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github birkir / kvikmyndr-app / src / store / index.js View on Github external
import Link from 'apollo-link-http';
import InMemoryCache from 'apollo-cache-inmemory';
import { Provider } from 'mobx-react/native';
import { ApolloProvider } from 'react-apollo';
import config from '../config';
import UI from './UI';
import Auth from './Auth';

if (__DEV__) { // eslint-disable-line
  const nativeXMLHttpRequest = XMLHttpRequest; // eslint-disable-line
  const devXMLHttpRequest = GLOBAL.originalXMLHttpRequest ? GLOBAL.originalXMLHttpRequest : GLOBAL.XMLHttpRequest; // eslint-disable-line
  GLOBAL.XMLHttpRequest = devXMLHttpRequest;
}

// Create new Apollo client
const link = new Link({
  uri: config.GRAPHQL_ENDPOINT,
});
const cache = new InMemoryCache();
const client = new ApolloClient({
  link,
  cache,
});


export default class Store {
  client = client;
  ui = new UI();
  auth = new Auth();
  
  async setup() {
    return true;

apollo-link-http

HTTP transport layer for GraphQL

MIT
Latest version published 4 years ago

Package Health Score

64 / 100
Full package analysis