32 lines
668 B
Markdown
32 lines
668 B
Markdown
# Multiple clients
|
|
|
|
You can specify multiple apollo clients if your app needs to connect to different GraphQL endpoints:
|
|
|
|
```js
|
|
const apolloProvider = new VueApollo({
|
|
clients: {
|
|
a: apolloClient,
|
|
b: otherApolloClient,
|
|
},
|
|
defaultClient: apolloClient,
|
|
})
|
|
```
|
|
|
|
In the component `apollo` option, you can define the client for all the queries, subscriptions and mutations with `$client` (only for this component):
|
|
|
|
```js
|
|
export default {
|
|
apollo: {
|
|
$client: 'b',
|
|
},
|
|
}
|
|
```
|
|
|
|
You can also specify the client in individual queries, subscriptions and mutations with the `client` property in the options:
|
|
|
|
```js
|
|
tags: {
|
|
query: gql`...`,
|
|
client: 'b',
|
|
}
|
|
``` |