From 5e393c5e7c3e8b927ff03a5e0ffd7ef2dec4f871 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Wed, 9 Feb 2022 15:32:45 +0900 Subject: [PATCH] Update page validation --- frontend/pages/projects/_id/labels/_label_id/edit.vue | 5 ++++- frontend/pages/projects/_id/labels/add.vue | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/pages/projects/_id/labels/_label_id/edit.vue b/frontend/pages/projects/_id/labels/_label_id/edit.vue index cbfd637e..faccf5a4 100644 --- a/frontend/pages/projects/_id/labels/_label_id/edit.vue +++ b/frontend/pages/projects/_id/labels/_label_id/edit.vue @@ -28,7 +28,10 @@ export default Vue.extend({ layout: 'project', - validate({ params, app }) { + validate({ params, query, app }) { + if (!['category', 'span'].includes((query.type as string))) { + return false + } if (/^\d+$/.test(params.id)) { return app.$services.project.findById(params.id) .then((res:ProjectDTO) => { diff --git a/frontend/pages/projects/_id/labels/add.vue b/frontend/pages/projects/_id/labels/add.vue index 0de776a7..94545a7b 100644 --- a/frontend/pages/projects/_id/labels/add.vue +++ b/frontend/pages/projects/_id/labels/add.vue @@ -38,7 +38,10 @@ export default Vue.extend({ layout: 'project', - validate({ params, app }) { + validate({ params, query, app }) { + if (!['category', 'span'].includes((query.type as string))) { + return false + } if (/^\d+$/.test(params.id)) { return app.$services.project.findById(params.id) .then((res:ProjectDTO) => {