Skip to content

Commit 6633573

Browse files
authored
Merge pull request #1663 from iamfaran/fix/environments-workspace-apps
[FIX] Fetch workspace apps correctly
2 parents 8b8521b + b7aec2b commit 6633573

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

client/packages/lowcoder/src/pages/setting/environments/EnvironmentDetail.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ const EnvironmentDetail: React.FC = () => {
8888
{/* Add more menu items here if needed */}
8989
</Menu>
9090
);
91-
debugger
9291

9392
if (isLoadingEnvironment) {
9493
return (

client/packages/lowcoder/src/pages/setting/environments/services/environments.service.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -291,23 +291,22 @@ export async function getWorkspaceApps(
291291
Authorization: `Bearer ${apiKey}`
292292
};
293293

294-
// Make the API request to get apps
295-
// Include the orgId as a query parameter if needed
294+
// First, switch to the target workspace
295+
await axios.put(`${apiServiceUrl}/api/organizations/switchOrganization/${workspaceId}`, {}, {
296+
headers
297+
});
298+
299+
// Then fetch applications without the orgId parameter
296300
const response = await axios.get(`${apiServiceUrl}/api/applications/list`, {
297-
headers,
298-
params: {
299-
orgId: workspaceId
300-
}
301+
headers
301302
});
302303

303304
// Check if response is valid
304305
if (!response.data || !response.data.data) {
305306
return [];
306307
}
307308

308-
const filteredApps = response.data.data.filter((app: App) => app.orgId === workspaceId);
309-
310-
return filteredApps;
309+
return response.data.data;
311310

312311
} catch (error) {
313312
// Handle and transform error
@@ -430,7 +429,7 @@ export async function getWorkspaceQueries(
430429
headers,
431430
params
432431
});
433-
debugger
432+
434433
// Check if response is valid
435434
if (!response.data) {
436435
return { queries: [], total: 0 };

0 commit comments

Comments
 (0)