Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Fix syntax errors in Standalone code example #1279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/source/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,23 @@ const link = new HttpLink({ uri });

const operation = {
query: gql`query { hello }`,
variables: {} //optional
operationName: {} //optional
context: {} //optional
extensions: {} //optional
variables: {}, //optional
operationName: {}, //optional
Copy link

@wdibi wdibi Jul 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
operationName: {}, //optional
operationName: '', //optional

I think operationName should be an empty String not an empty Object.

context: {}, //optional
extensions: {}, //optional
};

// execute returns an Observable so it can be subscribed to
execute(link, operation).subscribe({
next: data => console.log(`received data: ${JSON.stringify(data, null, 2)}`),
error: error => console.log(`received error ${error}`),
complete: () => console.log(`complete`),
})
});

// For single execution operations, a Promise can be used
makePromise(execute(link, operation))
.then(data => console.log(`received data ${JSON.stringify(data, null, 2)}`))
.catch(error => console.log(`received error ${error}`))
.catch(error => console.log(`received error ${error}`));
```

> Note: to run Apollo Link on the server, ensure that you install `node-fetch` and pass its default export to as the `fetch` parameter to `HttpLink`
Expand Down