Error Network error: forward is not a function in apollo header authorixation code example
Example: Error Network error: forward is not a function in apollo header authorixation
import { ApolloClient } from 'apollo-client'
import { HttpLink } from 'apollo-link-http'
import { setContext } from 'apollo-link-context'
import { onError } from 'apollo-link-error'
import { InMemoryCache } from 'apollo-cache-inmemory'
const httpLink = new HttpLink({
uri: // my api URI
})
const authLink = setContext((_, { headers }) => {
// my authorization stuff
})
const errorLink = onError(({ graphQLErrors, networkError }) => {
// my error handling logic
})
const apolloClient = new ApolloClient({
link: authLink.concat(errorLink, httpLink),
cache: new InMemoryCache()
})