Apollo-link: Batching and credentials with apollo-link-batch-http

Created on 16 Dec 2017  路  2Comments  路  Source: apollographql/apollo-link

What about intuitive API for BatchHttpLink like the one in example of HttpLink?

Seems to me it should look similar with BatchHttpLink to prevent dumb errors:

import ApolloClient from 'apollo-client';
import { BatchHttpLink } from 'apollo-link-batch-http';

const batchLink = new BatchHttpLink({
  uri: 'https://example.com/graphql',
  // Additional fetch options like `credentials` or `headers`
  credentials: 'same-origin',
});

const client = new ApolloClient({
  batchLink,
  // other options like cache
});

Most helpful comment

Thank you for opening an issue! We are planning to move batching into apollo-link-http. If you have any comments, please add them to #364!

That means that batching will use the same credentials settings as a single request.

All 2 comments

Came here looking for this. Looks like it's already planned. From the Batch Http Link docs:

Note: This package will be updated to remove the dependency on apollo-fetch an use the same options / API as the http-link

Thank you for opening an issue! We are planning to move batching into apollo-link-http. If you have any comments, please add them to #364!

That means that batching will use the same credentials settings as a single request.

Was this page helpful?
0 / 5 - 0 ratings