Merge pull request #7 from Algoteers/master

Simplify Apollo client config
This commit is contained in:
z@tOr authored and GitHub committed 2018-10-13 12:45:55 -03:00
commit 5277439f3f
3 files changed
+983 -7990

No files matched your search

+977 -7986
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -72,7 +72,7 @@
},
"dependencies": {
"@advancedalgos/key-vault-client": "0.0.6",
"@advancedalgos/teams-client": "0.0.18",
"@advancedalgos/teams-client": "0.0.20",
"@advancedalgos/web-components": "0.0.10",
"@babel/runtime": "^7.1.2",
"@material-ui/core": "^3.2.0",
+5 -3
View File
@@ -1,12 +1,12 @@
import { ApolloClient } from 'apollo-client'
import { HttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { ApolloLink, split, Observable } from 'apollo-link'
import { ApolloLink, Observable } from 'apollo-link'
import { onError } from 'apollo-link-error'
import { setContext } from 'apollo-link-context'
// import { WebSocketLink } from 'apollo-link-ws'
// import { SubscriptionClient } from 'subscriptions-transport-ws'
import { getMainDefinition } from 'apollo-utilities'
// import { getMainDefinition } from 'apollo-utilities'
import { getItem } from '../utils/local-storage'
@@ -45,6 +45,7 @@ wsClient.onReconnected(() => {
*/
const httpLink = new HttpLink({ uri: graphqlEndpoint })
/*
const link = split(
({ query }) => {
const { kind, operation } = getMainDefinition(query)
@@ -53,6 +54,7 @@ const link = split(
// new WebSocketLink(wsClient),
httpLink
)
*/
const authRetryLink = onError(
({ graphQLErrors, networkError, operation, forward }) => {
@@ -109,7 +111,7 @@ const authLink = setContext(async (_, { headers }) => {
const cache = new InMemoryCache().restore(window.__APOLLO_STATE__)
export const client = new ApolloClient({
link: ApolloLink.from([authRetryLink, authLink, link]),
link: ApolloLink.from([authRetryLink, authLink, httpLink]), // replaced link with httpLink
cache,
connectToDevTools: true
})