diff --git a/packages/apollo/src/configure.ts b/packages/apollo/src/configure.ts index 7a8086ba..a991ba9c 100644 --- a/packages/apollo/src/configure.ts +++ b/packages/apollo/src/configure.ts @@ -46,6 +46,7 @@ export interface ConfigureClientOptions extends Omit void; onNotAuthorized?: (err: ApolloError["networkError"], operation: Operation) => void; removeToken?: () => void; + terminatingLink?: ApolloLink; } const defaultFetch = typeof window !== "undefined" ? window.fetch : undefined; @@ -70,6 +71,7 @@ export const configureClient = ({ onNetworkError, onNotAuthorized, removeToken, + terminatingLink, uri, ...otherOptions }: ConfigureClientOptions) => { @@ -170,7 +172,9 @@ export const configureClient = ({ const links: ApolloLink[] = [errorLink, retryLink, authLink, ...extraLinks]; - if (batch) { + if (terminatingLink) { + links.push(terminatingLink); + } else if (batch) { links.push( new BatchHttpLink({ batchInterval,