From 965f760da066cb8c35c739088cfb3ac0e296a5c7 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Fri, 7 Jan 2022 09:20:38 +0900 Subject: [PATCH] Update useLabelList to pass LabelApplicationService --- frontend/composables/useLabelList.ts | 15 +++++++-------- .../projects/_id/image-classification/index.vue | 5 +++-- .../projects/_id/text-classification/index.vue | 2 +- .../application/label/labelApplicationService.ts | 3 ++- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/frontend/composables/useLabelList.ts b/frontend/composables/useLabelList.ts index b6c770c9..4a84b267 100644 --- a/frontend/composables/useLabelList.ts +++ b/frontend/composables/useLabelList.ts @@ -1,27 +1,26 @@ -import { computed, reactive, ref, useContext } from '@nuxtjs/composition-api' +import { computed, reactive, useContext } from '@nuxtjs/composition-api' import { LabelDTO } from '@/services/application/label/labelData' import { CreateLabelCommand , UpdateLabelCommand } from '@/services/application/label/labelCommand' +import { LabelApplicationService } from '@/services/application/label/labelApplicationService' - -export const useLabelList = () => { +export const useLabelList = (service: LabelApplicationService) => { const state = reactive({ labels: [] as LabelDTO[] }) const { app } = useContext() - const $services = app.$services const getLabelList = async( projectId: string ) => { - state.labels = await $services.label.list(projectId) + state.labels = await service.list(projectId) } const createLabel = async( projectId: string, command: CreateLabelCommand ) => { - await $services.label.create(projectId, command) + await service.create(projectId, command) await getLabelList(projectId) } @@ -29,14 +28,14 @@ export const useLabelList = () => { projectId: string, command: UpdateLabelCommand ) => { - await $services.label.update(projectId, command) + await service.update(projectId, command) } const deleteLabelList = async( projectId: string, items: LabelDTO[] ) => { - await $services.label.bulkDelete(projectId, items) + await service.bulkDelete(projectId, items) await getLabelList(projectId) } diff --git a/frontend/pages/projects/_id/image-classification/index.vue b/frontend/pages/projects/_id/image-classification/index.vue index 7a0f90d0..2646aa4a 100644 --- a/frontend/pages/projects/_id/image-classification/index.vue +++ b/frontend/pages/projects/_id/image-classification/index.vue @@ -70,7 +70,7 @@