Forked from
clients / wotwizard-ui
258 commits behind the upstream repository.
-
Pierre-Jean CHANCELLIER authoredPierre-Jean CHANCELLIER authored
index.js 791 B
import { HttpLink } from 'apollo-link-http'
import { setContext } from 'apollo-link-context'
import { from } from 'apollo-link'
import { InMemoryCache } from 'apollo-cache-inmemory'
export default ctx => {
const ssrMiddleware = setContext((_, { headers }) => {
if (process.client) return headers
return {
headers
}
})
const httpLink = new HttpLink({
uri: 'https://wwgql.coinduf.eu'
})
const link = from([ssrMiddleware, httpLink])
const cache = new InMemoryCache({
typePolicies: {
Event: {
keyFields: ['block',['bct']]
},
EventId: {
keyFields: ['member',['hash'],'inOut']
},
Identity: {
keyFields: ['hash']
}
}
})
return {
link,
cache,
defaultHttpLink: false
}
}