useEntityManager.ts 503 B

123456789101112131415
  1. import EntityManager from "~/services/data/entityManager";
  2. import {useAp2iRequestService} from "~/composables/data/useAp2iRequestService";
  3. import {useRepo} from "pinia-orm";
  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. }