From e09991a8bd6188e47b3f5297c35af9fd64492aeb Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 11 Apr 2024 11:46:42 +0700 Subject: [PATCH] refactor: function and type --- src/pages/01_branch-management/MainPage.vue | 23 +++++++-------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/pages/01_branch-management/MainPage.vue b/src/pages/01_branch-management/MainPage.vue index bf8df30a..a24b296c 100644 --- a/src/pages/01_branch-management/MainPage.vue +++ b/src/pages/01_branch-management/MainPage.vue @@ -169,17 +169,12 @@ function changeSubject( typeBranch: 'headOffice' | 'subBranch', ) { if (typeBranch === 'headOffice') { - if (formType === 'create') { - return 'เพิ่มสำนักงานใหญ่'; - } - return 'แก้ไขสำนักงานใหญ่'; + return formType === 'create' ? 'เพิ่มสำนักงานใหญ่' : 'แก้ไขสำนักงานใหญ่'; } if (typeBranch === 'subBranch') { - if (formType === 'create') { - return 'เพิ่มสาขา'; - } - return 'แก้ไขสาขา'; + return formType === 'create' ? 'เพิ่มสาขา' : 'แก้ไขสาขา'; } + return ''; } function triggerCreateSubBranch(code: string, id: string) { @@ -324,7 +319,7 @@ async function submitForm( await branchContactStore.create( result.id, inputBranchContactCreate, - profileFile.value as File, + profileFile.value, ); getTree(); modal.value = false; @@ -353,7 +348,7 @@ async function submitForm( await branchContactStore.create( result.id, inputBranchContactCreate, - profileFile.value as File, + profileFile.value, ); getTree(); modal.value = false; @@ -737,15 +732,13 @@ onMounted(async () => {