Skip to content

Commit 37ae62e

Browse files
authored
fix: Modify code check (#1827)
1 parent 484898f commit 37ae62e

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

packages/toolbars/upload/src/Main.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,18 @@ export default {
10111011
const existingCategories = Array.isArray(existing.categories)
10121012
? existing.categories.map((item: any) => item?.id || item).filter(Boolean)
10131013
: []
1014+
let relationParams: Record<string, any>
1015+
1016+
if (groupId) {
1017+
relationParams = { groups: [groupId] }
1018+
} else if (existingGroups.length) {
1019+
relationParams = { groups: existingGroups }
1020+
} else {
1021+
relationParams = {
1022+
categories: existingCategories.length ? existingCategories : blockParams.categories || []
1023+
}
1024+
}
1025+
10141026
const updateParams = {
10151027
name_cn: blockParams.name_cn,
10161028
label: blockParams.label,
@@ -1020,11 +1032,7 @@ export default {
10201032
public_scope_tenants: existing.public_scope_tenants || [],
10211033
tags: existing.tags || [],
10221034
description: existing.description || '',
1023-
...(groupId
1024-
? { groups: [groupId] }
1025-
: existingGroups.length
1026-
? { groups: existingGroups }
1027-
: { categories: existingCategories.length ? existingCategories : blockParams.categories || [] })
1035+
...relationParams
10281036
}
10291037
10301038
blockData = await updateBlock(existing.id, updateParams, appId)

0 commit comments

Comments
 (0)