From 5d96ab4f68f80156b02ec120677f0d20a9fba788 Mon Sep 17 00:00:00 2001 From: Stephan Schneider Date: Fri, 7 Sep 2018 13:12:44 +0200 Subject: [PATCH] docs(remote-schema): adjust Fetcher interface (#933) --- CHANGELOG.md | 3 ++- docs/source/remote-schemas.md | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcbfbd20810..20c9c8d6a53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ * Documentation updates.
[@Amorites](https://github.com/Amorites) in [#944](https://github.com/apollographql/graphql-tools/pull/944)
[@trevor-scheer](https://github.com/trevor-scheer) in [#946](https://github.com/apollographql/graphql-tools/pull/946)
- [@dnalborczyk](https://github.com/dnalborczyk) in [#934](https://github.com/apollographql/graphql-tools/pull/934) + [@dnalborczyk](https://github.com/dnalborczyk) in [#934](https://github.com/apollographql/graphql-tools/pull/934)
+ [@zcei](https://github.com/zcei) in [#933](https://github.com/apollographql/graphql-tools/pull/933) ### v3.1.1 diff --git a/docs/source/remote-schemas.md b/docs/source/remote-schemas.md index 0833161c8a6..3f385ec54e7 100644 --- a/docs/source/remote-schemas.md +++ b/docs/source/remote-schemas.md @@ -104,7 +104,7 @@ You can also use a fetcher (like apollo-fetch or node-fetch) instead of a link. type Fetcher = (operation: Operation) => Promise; type Operation { - query: string; + query: DocumentNode; operationName?: string; variables?: Object; context?: Object; @@ -161,8 +161,10 @@ Basic usage ```js import fetch from 'node-fetch'; +import { print } from 'graphql': -const fetcher = async ({ query, variables, operationName, context }) => { +const fetcher = async ({ query: queryDocument, variables, operationName, context }) => { + const query = print(queryDocument); const fetchResult = await fetch('http://api.githunt.com/graphql', { method: 'POST', headers: { @@ -186,8 +188,10 @@ Authentication headers from context ```js import fetch from 'node-fetch'; +import { print } from 'graphql': -const fetcher = async ({ query, variables, operationName, context }) => { +const fetcher = async ({ query: queryDocument, variables, operationName, context }) => { + const query = print(queryDocument); const fetchResult = await fetch('http://api.githunt.com/graphql', { method: 'POST', headers: {