Im trying to figure out how to use apollo-link-http with apollo-upload-client.
Both create a terminating link, but how could I use those 2 together? In my index.js I have like this, but it wont work because both links are terminating =>
const uploadLink = createUploadLink({ uri: process.env.REACT_APP_GRAPHQL_URL });
const httpLink = new HttpLink({ uri: process.env.REACT_APP_GRAPHQL_URL });
const client = new ApolloClient({
link: ApolloLink.from([ authLink, logoutLink, stateLink, uploadLink, httpLink ]),
cache,
});
Any help? I have not much experience with Apollo/Graphql, but I would like to use the file upload component.
You do not need the http link if you use apollo-upload-client
with version higher than 6.
You can try like this:
const uploadLink = createUploadLink({ uri: process.env.REACT_APP_GRAPHQL_URL });
const client = new ApolloClient({
link: ApolloLink.from([ authLink, logoutLink, stateLink, uploadLink ]),
cache,
});