Skip to content

Commit aabcf78

Browse files
author
Guillaume Chau
committed
Merge branch 'master' of github.com:Akryum/vue-cli-plugin-apollo
2 parents cf030ba + fad559d commit aabcf78

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

docs/guide/configuration.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,40 @@ createApolloClient({
77
// URL to the HTTP API
88
httpEndpoint,
99
// Url to the Websocket API
10-
wsEndpoint = null,
10+
wsEndpoint: null,
1111
// Token used in localstorage
12-
tokenName = 'apollo-token',
12+
tokenName: 'apollo-token',
1313
// Enable this if you use Query persisting with Apollo Engine
14-
persisting = false,
14+
persisting: false,
15+
// Or, advanced persisting options, see https://github.com/apollographql/apollo-link-persisted-queries#options
16+
// persisting: {
17+
// enabled: false,
18+
// generateHash: query => sha256()
19+
// .update(print(query))
20+
// .digest('hex'),
21+
//},
1522
// Is currently Server-Side Rendering or not
16-
ssr = false,
23+
ssr: false,
1724
// Only use Websocket for all requests (including queries and mutations)
18-
websocketsOnly = false,
25+
websocketsOnly: false,
1926
// Custom starting link.
2027
// If you want to replace the default HttpLink, set `defaultHttpLink` to false
21-
link = null,
28+
link: null,
2229
// If true, add the default HttpLink.
2330
// Disable it if you want to replace it with a terminating link using `link` option.
24-
defaultHttpLink = true,
31+
defaultHttpLink: true,
2532
// Options for the default HttpLink
26-
httpLinkOptions = {},
33+
httpLinkOptions: {},
2734
// Custom Apollo cache implementation (default is apollo-cache-inmemory)
28-
cache = null,
35+
cache: null,
2936
// Options for the default cache
30-
inMemoryCacheOptions = {},
37+
inMemoryCacheOptions: {},
3138
// Additional Apollo client options
32-
apollo = {},
39+
apollo: {},
3340
// apollo-link-state options
34-
clientState = null,
41+
clientState: null,
3542
// Function returning Authorization header token
36-
getAuth = defaultGetAuth,
43+
getAuth: defaultGetAuth,
3744
})
3845
```
3946

graphql-client/src/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,12 @@ export function createApolloClient ({
100100
}
101101

102102
if (!disableHttp) {
103-
if (persisting) {
104-
link = createPersistedQueryLink().concat(link)
103+
let persistingOpts = {}
104+
if (typeof persisting === 'object' && persisting != null) {
105+
persistingOpts = persisting
106+
}
107+
if (persistingOpts.enabled) {
108+
link = createPersistedQueryLink(persistingOpts).concat(link)
105109
}
106110
}
107111

0 commit comments

Comments
 (0)