MCPcopy Create free account
hub / github.com/decaporg/decap-cms / getApolloClient

Method getApolloClient

packages/decap-cms-backend-gitlab/src/API.ts:243–268  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

241 }
242
243 getApolloClient() {
244 const authLink = setContext((_, { headers }) => {
245 return {
246 headers: {
247 'Content-Type': 'application/json; charset=utf-8',
248 ...headers,
249 authorization: this.token ? `Bearer ${this.token}` : '',
250 },
251 };
252 });
253 const httpLink = createHttpLink({ uri: this.graphQLAPIRoot });
254 return new ApolloClient({
255 link: authLink.concat(httpLink),
256 cache: new InMemoryCache(),
257 defaultOptions: {
258 watchQuery: {
259 fetchPolicy: NO_CACHE,
260 errorPolicy: 'ignore',
261 },
262 query: {
263 fetchPolicy: NO_CACHE,
264 errorPolicy: 'all',
265 },
266 },
267 });
268 }
269
270 reset() {
271 return this.graphQLClient?.resetStore();

Callers 1

constructorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected