From 028caca8f14c487154eb150f1fd493ec257c7577 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Fri, 4 Jun 2021 13:24:55 +0900 Subject: [PATCH] Update label page validation --- frontend/pages/projects/_id/labels/index.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/pages/projects/_id/labels/index.vue b/frontend/pages/projects/_id/labels/index.vue index 3c53946b..07b39af8 100644 --- a/frontend/pages/projects/_id/labels/index.vue +++ b/frontend/pages/projects/_id/labels/index.vue @@ -56,6 +56,7 @@ import FormDelete from '@/components/label/FormDelete.vue' import FormUpload from '@/components/label/FormUpload.vue' import LabelList from '@/components/label/LabelList.vue' import { LabelDTO } from '~/services/application/label/labelData' +import { ProjectDTO } from '~/services/application/project/projectData' export default Vue.extend({ layout: 'project', @@ -183,8 +184,14 @@ export default Vue.extend({ } }, - validate({ params }) { - return /^\d+$/.test(params.id) + validate({ params, app }) { + if (/^\d+$/.test(params.id)) { + return app.$services.project.findById(params.id) + .then((res:ProjectDTO) => { + return res.canDefineLabel + }) + } + return false } })