Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Akryum/vue-cli-plugin-apollo
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Oct 19, 2019
2 parents cf030ba + fad559d commit aabcf78
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
33 changes: 20 additions & 13 deletions docs/guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,40 @@ createApolloClient({
// URL to the HTTP API
httpEndpoint,
// Url to the Websocket API
wsEndpoint = null,
wsEndpoint: null,
// Token used in localstorage
tokenName = 'apollo-token',
tokenName: 'apollo-token',
// Enable this if you use Query persisting with Apollo Engine
persisting = false,
persisting: false,
// Or, advanced persisting options, see https://github.com/apollographql/apollo-link-persisted-queries#options
// persisting: {
// enabled: false,
// generateHash: query => sha256()
// .update(print(query))
// .digest('hex'),
//},
// Is currently Server-Side Rendering or not
ssr = false,
ssr: false,
// Only use Websocket for all requests (including queries and mutations)
websocketsOnly = false,
websocketsOnly: false,
// Custom starting link.
// If you want to replace the default HttpLink, set `defaultHttpLink` to false
link = null,
link: null,
// If true, add the default HttpLink.
// Disable it if you want to replace it with a terminating link using `link` option.
defaultHttpLink = true,
defaultHttpLink: true,
// Options for the default HttpLink
httpLinkOptions = {},
httpLinkOptions: {},
// Custom Apollo cache implementation (default is apollo-cache-inmemory)
cache = null,
cache: null,
// Options for the default cache
inMemoryCacheOptions = {},
inMemoryCacheOptions: {},
// Additional Apollo client options
apollo = {},
apollo: {},
// apollo-link-state options
clientState = null,
clientState: null,
// Function returning Authorization header token
getAuth = defaultGetAuth,
getAuth: defaultGetAuth,
})
```

Expand Down
8 changes: 6 additions & 2 deletions graphql-client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ export function createApolloClient ({
}

if (!disableHttp) {
if (persisting) {
link = createPersistedQueryLink().concat(link)
let persistingOpts = {}
if (typeof persisting === 'object' && persisting != null) {
persistingOpts = persisting
}
if (persistingOpts.enabled) {
link = createPersistedQueryLink(persistingOpts).concat(link)
}
}

Expand Down

0 comments on commit aabcf78

Please sign in to comment.