Ocelot-Social/webapp/plugins/apollo-config.js
mattwr18 6cf067937d Clean up
- remove the code for subscriptions to Post as we won't implement this
  at this time... I've created a new branch with the code that can be
built on later
- remove unused subscription path
- add possibility to use websockets uri for production env.
2020-02-05 20:24:23 +01:00

24 lines
740 B
JavaScript

import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'
import introspectionQueryResultData from './apollo-config/fragmentTypes.json'
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData,
})
export default ({ app }) => {
const backendUrl = process.env.GRAPHQL_URI || 'http://localhost:4000'
return {
wsEndpoint: process.env.WEBSOCKETS_URI || 'ws://localhost:4000/graphql',
httpEndpoint: process.server ? backendUrl : '/api',
httpLinkOptions: {
credentials: 'same-origin',
},
credentials: true,
tokenName: 'human-connection-token',
persisting: false,
websocketsOnly: false,
cache: new InMemoryCache({ fragmentMatcher }),
}
}