Files
apollo/docs/guide/multiple-clients.md
T
Guillaume Chau 56f317af07 docs: big update
2018-06-18 18:11:46 +02:00

668 B

Multiple clients

You can specify multiple apollo clients if your app needs to connect to different GraphQL endpoints:

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):

export default {
  apollo: {
    $client: 'b',
  },
}

You can also specify the client in individual queries, subscriptions and mutations with the client property in the options:

tags: {
  query: gql`...`,
  client: 'b',
}