index.ts 635 B

12345678910111213141516171819202122
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type { App } from 'vue'
  3. import {
  4. DefaultApolloClient,
  5. provideApolloClient,
  6. } from '@vue/apollo-composable'
  7. import type { CacheInitializerModules } from '#shared/types/server/apollo/client.ts'
  8. import { createApolloClient } from './client.ts'
  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