long story short: i'd like to override the uri of the apollo client's network interface without creating a new one.
i share the initial client with the combined redux reducer so it's mandatory to use the same instance. i tried to override the networkInterface property of the client but it doesn't work and maybe it should not and i tried to override the uri with a middleware but it's not clear what property of the request object should i set in there.
I'm also interested in this. I tried a few methods of trying to set the client's uri in context for the rest of the tree, but ultimately I had to create new clients.
If you want to do this, you should write your own network interface! 馃槉
It鈥檚 not that bad, you can even extend HTTPFetchNetworkInterface
if you would like: https://github.com/apollographql/apollo-client/blob/master/src/transport/networkInterface.ts
import { HTTPFetchNetworkInterface } from 'apollo-client'
class NetworkInterface extends HTTPFetchNetworkInterface {
setUri(uri) {
this._uri = uri
}
}
const networkInterface = new NetworkInterface('/grapqlendpoint1')
networkInterface.setUri('/graphqlendpoint2')
thanks @calebmer !
Great! Looks like we can close this, thanks for the tip @calebmer
Most helpful comment
thanks @calebmer !