MCPcopy Create free account
hub / github.com/Sly777/ran / createClient

Function createClient

libraries/apolloClient.js:14–38  ·  view source on GitHub ↗
(headers, token, initialState)

Source from the content-addressed store, hash-verified

12});
13
14function createClient(headers, token, initialState) {
15 let accessToken = token;
16
17 (async () => {
18 // eslint-disable-next-line no-param-reassign
19 accessToken = token || (await persist.willGetAccessToken());
20 })();
21
22 const authLink = new ApolloLink((operation, forward) => {
23 operation.setContext({
24 headers: {
25 authorization: accessToken
26 }
27 });
28 return forward(operation);
29 }).concat(httpLink);
30
31 return new ApolloClient({
32 headers,
33 link: authLink,
34 connectToDevTools: process.browser,
35 ssrMode: !process.browser,
36 cache: new InMemoryCache().restore(initialState || {})
37 });
38}
39
40export default (headers, token, initialState) => {
41 if (!process.browser) {

Callers 1

apolloClient.jsFile · 0.85

Calls 1

willGetAccessTokenMethod · 0.80

Tested by

no test coverage detected