Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyaha committed Jul 31, 2018
1 parent 4af2360 commit 47670de
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/pages/docs/transport/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ app.use(
);
```


## Authenticating Resolvers

You can authenticate your own resolvers with `JSAccounts` authentication flow, by using `authenticated` method from this package.
Expand All @@ -132,10 +131,13 @@ import { authenticated } from '@accounts/graphql-api';

export const resolver = {
Mutation: {
updateUserProfile: authenticated(AccountsServer, (rootValue, args, context) => {
// Write your resolver here
// context.user - the current authenticated user!
}),
updateUserProfile: authenticated(
AccountsServer,
(rootValue, args, context) => {
// Write your resolver here
// context.user - the current authenticated user!
}
),
},
};
```
Expand Down Expand Up @@ -234,7 +236,7 @@ const accountsGraphQL = new GraphQLClient({
});
```

## Using with Apollo Link
## Using with Apollo Link

In order to send the accounts token on every request sent to your GraphQL server, apollo requires you to implment an apollo-link. This link is usually quite generic when using accounts-js so we've implmeneted the apollo-link you need and offer it as a utility package.

Expand All @@ -256,4 +258,4 @@ export const apolloClient = new ApolloClient({
link: ApolloLink.from([authLink, httpLink]),
cache,
});
```
```

0 comments on commit 47670de

Please sign in to comment.