From a2da2edcb5dd3a69cfbbca477ca986816860460e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9C=8D=E4=B8=96=E6=9D=B0?= Date: Tue, 4 Mar 2025 09:25:28 +0800 Subject: [PATCH] fix: condition --- .../plugin-mobile/src/server/plugin.ts | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-mobile/src/server/plugin.ts b/packages/plugins/@nocobase/plugin-mobile/src/server/plugin.ts index 4dfa0b53ff..37cafa5c4b 100644 --- a/packages/plugins/@nocobase/plugin-mobile/src/server/plugin.ts +++ b/packages/plugins/@nocobase/plugin-mobile/src/server/plugin.ts @@ -112,21 +112,20 @@ export class PluginMobileServer extends Plugin { parentId: ctx.action.params.values, }, }); - if (tabs.length > 1 || !tabs[0].hidden) { - return; - } - const repository = this.app.db.getRepository('rolesMobileRoutes'); - const whereOrValues = { - roleName: ctx.action.params.associatedIndex, - mobileRouteId: tabs[0].id, - }; - const rolesMobileRoute = await repository.findOne({ where: whereOrValues }); + if (tabs.length === 1 && tabs[0].hidden) { + const repository = this.app.db.getRepository('rolesMobileRoutes'); + const whereOrValues = { + roleName: ctx.action.params.associatedIndex, + mobileRouteId: tabs[0].id, + }; + const rolesMobileRoute = await repository.findOne({ where: whereOrValues }); - if (actionName === 'add') { - !rolesMobileRoute && (await repository.create({ values: whereOrValues })); - } - if (actionName === 'remove') { - rolesMobileRoute && (await repository.destroy({ filter: whereOrValues })); + if (actionName === 'add') { + !rolesMobileRoute && (await repository.create({ values: whereOrValues })); + } + if (actionName === 'remove') { + rolesMobileRoute && (await repository.destroy({ filter: whereOrValues })); + } } }; this.app.resourceManager.registerActionHandlers({