From b7aec2bb4e383282bac2441ae8dddeecfb828243 Mon Sep 17 00:00:00 2001 From: Faran Javed Date: Wed, 30 Apr 2025 21:43:35 +0500 Subject: [PATCH] [FIX] Fetch workspace apps correctly --- .../environments/EnvironmentDetail.tsx | 1 - .../services/environments.service.ts | 19 +++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/client/packages/lowcoder/src/pages/setting/environments/EnvironmentDetail.tsx b/client/packages/lowcoder/src/pages/setting/environments/EnvironmentDetail.tsx index d16f52c24..f65ca4f89 100644 --- a/client/packages/lowcoder/src/pages/setting/environments/EnvironmentDetail.tsx +++ b/client/packages/lowcoder/src/pages/setting/environments/EnvironmentDetail.tsx @@ -88,7 +88,6 @@ const EnvironmentDetail: React.FC = () => { {/* Add more menu items here if needed */} ); - debugger if (isLoadingEnvironment) { return ( diff --git a/client/packages/lowcoder/src/pages/setting/environments/services/environments.service.ts b/client/packages/lowcoder/src/pages/setting/environments/services/environments.service.ts index a2f74b6d3..af1268918 100644 --- a/client/packages/lowcoder/src/pages/setting/environments/services/environments.service.ts +++ b/client/packages/lowcoder/src/pages/setting/environments/services/environments.service.ts @@ -291,13 +291,14 @@ export async function getWorkspaceApps( Authorization: `Bearer ${apiKey}` }; - // Make the API request to get apps - // Include the orgId as a query parameter if needed + // First, switch to the target workspace + await axios.put(`${apiServiceUrl}/api/organizations/switchOrganization/${workspaceId}`, {}, { + headers + }); + + // Then fetch applications without the orgId parameter const response = await axios.get(`${apiServiceUrl}/api/applications/list`, { - headers, - params: { - orgId: workspaceId - } + headers }); // Check if response is valid @@ -305,9 +306,7 @@ export async function getWorkspaceApps( return []; } - const filteredApps = response.data.data.filter((app: App) => app.orgId === workspaceId); - - return filteredApps; + return response.data.data; } catch (error) { // Handle and transform error @@ -430,7 +429,7 @@ export async function getWorkspaceQueries( headers, params }); - debugger + // Check if response is valid if (!response.data) { return { queries: [], total: 0 };