diff --git a/frontend/nuxt.config.js b/frontend/nuxt.config.js index 41e9f1df..6e6799b0 100644 --- a/frontend/nuxt.config.js +++ b/frontend/nuxt.config.js @@ -50,7 +50,8 @@ export default { plugins: [ '~/plugins/filters.js', '~/plugins/vue-youtube.js', - '~/plugins/vue-shortkey.js' + '~/plugins/vue-shortkey.js', + '~/plugins/services.ts' ], /* ** Nuxt.js modules diff --git a/frontend/plugins/services.ts b/frontend/plugins/services.ts new file mode 100644 index 00000000..de51a812 --- /dev/null +++ b/frontend/plugins/services.ts @@ -0,0 +1,24 @@ +import { Plugin } from '@nuxt/types' +import { FromApiLabelItemListRepository } from '@/repositories/label/api' +import { LabelApplicationService } from '@/services/application/label.service' + +export interface Services { + label: LabelApplicationService +} + +declare module 'vue/types/vue' { + interface Vue { + readonly $services: Services + } +} + +const plugin: Plugin = (context, inject) => { + const labelRepository = new FromApiLabelItemListRepository() + const label = new LabelApplicationService(labelRepository) + const services: Services = { + label + } + inject('services', services) +} + +export default plugin