useEntityManager.ts 486 B

123456789101112131415
  1. import { useRepo } from 'pinia-orm'
  2. import EntityManager from '~/services/data/entityManager'
  3. import { useAp2iRequestService } from '~/composables/data/useAp2iRequestService'
  4. let entityManager: EntityManager | null = null
  5. export const useEntityManager = () => {
  6. if (entityManager === null) {
  7. const { apiRequestService } = useAp2iRequestService()
  8. const getRepo = useRepo
  9. entityManager = new EntityManager(apiRequestService, getRepo)
  10. }
  11. return { em: entityManager }
  12. }