How to use the apollo-upload-client.createNetworkInterface function in apollo-upload-client

To help you get started, we’ve selected a few apollo-upload-client 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 assembl / assembl / assembl / static2 / js / app / client.js View on Github external
}
      ]
    }
  }
});

// The object id retrieved is already unique, it's actually
// ObjectType:primaryKey encoded in base64, so we define our
// own dataIdFromObject instead of using the default one `${o.__typename}:o.id`.
// This allows us to define a custom resolver for the node query.
// for more info about customResolvers, read
// http://dev.apollodata.com/react/query-splitting.html

const dataIdFromObject = o => o.id;

const networkInterface = createNetworkInterface({
  uri: getFullPath('graphql', { slug: getDiscussionSlug() }),
  opts: {
    credentials: 'same-origin'
  }
});

// trace every graphql operation in sentry
networkInterface.use([
  {
    applyMiddleware: function (req, next) {
      Sentry.addBreadcrumb({
        category: 'graphql',
        message: `GraphQL operation: ${req.request.operationName}`,
        data: {
          variables: req.request.variables
        },

apollo-upload-client

A terminating Apollo Link for Apollo Client that fetches a GraphQL multipart request if the GraphQL variables contain files (by default FileList, File, or Blob instances), or else fetches a regular GraphQL POST or GET request (depending on the config and

MIT
Latest version published 1 year ago

Package Health Score

68 / 100
Full package analysis