apollo.js 875 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Using next-with-apollo
  3. * https://github.com/lfades/next-with-apollo
  4. *
  5. * Changes:
  6. * * Reading endpoint and prodEndpoint from a config file
  7. * * Setting request to handle credentials.
  8. */
  9. // import { withData } from 'next-apollo'
  10. // import { HttpLink } from 'apollo-boost'
  11. // import { ApolloLink } from 'apollo-link'
  12. // import { onError } from 'apollo-link-error'
  13. import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'
  14. const client = new ApolloClient({
  15. cache: new InMemoryCache(),
  16. link: new HttpLink({
  17. uri: 'http://localhost:8801/',
  18. credentials: 'include'
  19. })
  20. })
  21. // const errorLink = onError(errors => { })
  22. // const httpLink = new HttpLink({
  23. // uri: 'http://localhost:8801/',
  24. // credentials: 'include'
  25. // })
  26. // const config = {
  27. // link: ApolloLink.from([
  28. // errorLink,
  29. // httpLink
  30. // ])
  31. // }
  32. export default client