From 7eeeaa29662f6012883fd45af85af8b7737748eb Mon Sep 17 00:00:00 2001 From: gene9831 Date: Thu, 2 Jan 2025 11:44:08 +0800 Subject: [PATCH] fix: fix param type error when create group --- packages/plugins/block/src/js/blockSetting.jsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/plugins/block/src/js/blockSetting.jsx b/packages/plugins/block/src/js/blockSetting.jsx index 3a8d804f7..aa893d581 100644 --- a/packages/plugins/block/src/js/blockSetting.jsx +++ b/packages/plugins/block/src/js/blockSetting.jsx @@ -727,15 +727,25 @@ export const getBlockById = async (id) => { export const createOrUpdateCategory = async ({ categoryId, ...params }, isEdit) => { const appId = getAppId() - params.app = Number(appId) const replaceCategoryWithGroup = useBlock().shouldReplaceCategoryWithGroup() - let requestFunc = replaceCategoryWithGroup ? updateGroup : updateCategory + let requestFunc + + if (replaceCategoryWithGroup) { + params.app = appId + requestFunc = updateGroup + } else { + params.app = Number(appId) + requestFunc = updateCategory + } if (!isEdit) { - if (!replaceCategoryWithGroup) { + // 替换成创建接口 + if (replaceCategoryWithGroup) { + requestFunc = createGroup + } else { + requestFunc = createCategory params.category_id = categoryId } - requestFunc = replaceCategoryWithGroup ? createGroup : createCategory } const res = await requestFunc(params)