Skip to content

Commit

Permalink
docs(remote-schema): adjust Fetcher interface (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
zcei authored and hwillson committed Sep 7, 2018
1 parent 5d05787 commit 5d96ab4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* Documentation updates. <br/>
[@Amorites](https://github.com/Amorites) in [#944](https://github.com/apollographql/graphql-tools/pull/944) <br/>
[@trevor-scheer](https://github.com/trevor-scheer) in [#946](https://github.com/apollographql/graphql-tools/pull/946) <br/>
[@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) <br/>
[@zcei](https://github.com/zcei) in [#933](https://github.com/apollographql/graphql-tools/pull/933)

### v3.1.1

Expand Down
10 changes: 7 additions & 3 deletions docs/source/remote-schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<ExecutionResult>;

type Operation {
query: string;
query: DocumentNode;
operationName?: string;
variables?: Object;
context?: Object;
Expand Down Expand Up @@ -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: {
Expand All @@ -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: {
Expand Down

0 comments on commit 5d96ab4

Please sign in to comment.