apollo-client
apollo-client copied to clipboard
how to enable no-cors mode in apollo-client ^3.0.0
looking for something similar from the APIs before v3.0.0 (given below)
export const client = new ApolloClient({
uri: ""
cache: new InMemoryCache(),
fetchOptions: {
mode: 'no-cors'
}
});
Have you found a solution to this? We are also very much in trouble here.
any updates in this??
I found the following on stackoverflow:
import { ApolloClient, HttpLink } from '@apollo/client';
const client = new ApolloClient({
link: new HttpLink({
uri: 'your client uri goes here',
fetchOptions: {
mode: 'cors', // no-cors, *cors, same-origin
}
}),
});
https://stackoverflow.com/a/72316966/8184729
@RemyMachado is correct - see https://www.apollographql.com/docs/react/api/link/apollo-link-http/#fetchoptions for more info. Thanks all!