index.ts 638 B

12345678910111213141516171819202122232425
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import {
  3. DefaultApolloClient,
  4. provideApolloClient,
  5. } from '@vue/apollo-composable'
  6. import type { CacheInitializerModules } from '#shared/types/server/apollo/client.ts'
  7. import { createApolloClient } from './client.ts'
  8. import type { App } from 'vue'
  9. const initializeApolloClient = (
  10. app: App,
  11. cacheInitializerModules: CacheInitializerModules = {},
  12. ) => {
  13. const apolloClient = createApolloClient(cacheInitializerModules)
  14. app.provide(DefaultApolloClient, apolloClient)
  15. provideApolloClient(apolloClient)
  16. }
  17. export default initializeApolloClient