Skip to content

Commit 8b8521b

Browse files
authored
Merge pull request #1662 from iamfaran/fix/environments-new-plugin
Fix environments response for new plugin
2 parents 1ec6c93 + 21a74e2 commit 8b8521b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function getManagedWorkspaces(
2222

2323
try {
2424
const res = await axios.get(`/api/plugins/enterprise/org/list`);
25-
const all: ManagedOrg[] = res.data;
25+
const all: ManagedOrg[] = res.data.data;
2626
return all.filter(org => org.environmentId === environmentId);
2727
} catch (err) {
2828
const errorMsg = err instanceof Error ? err.message : "Failed to fetch managed workspaces";
@@ -100,7 +100,7 @@ export async function unconnectManagedWorkspace(orgGid: string) {
100100

101101
export async function getManagedApps(environmentId: string) {
102102
const res = await axios.get(`/api/plugins/enterprise/app/list`);
103-
const allApps = res.data;
103+
const allApps = res.data.data;
104104
return allApps.filter((app: any) => app.environmentId === environmentId);
105105
}
106106

@@ -149,7 +149,7 @@ export const getManagedDataSources = async (environmentId: string): Promise<any[
149149
const response = await axios.get(
150150
`/api/plugins/enterprise/datasource/list?environmentId=${environmentId}`
151151
);
152-
return response.data || [];
152+
return response.data.data || [];
153153
} catch (error) {
154154
console.error("Error fetching managed data sources:", error);
155155
throw error;
@@ -204,14 +204,15 @@ export async function getManagedQueries(environmentId: string): Promise<Query[]>
204204
environmentId
205205
}
206206
});
207+
console.log("Managed queries response function:", response.data);
207208

208-
if (!response.data || !Array.isArray(response.data)) {
209+
if (!response.data.data || !Array.isArray(response.data.data)) {
209210
return [];
210211
}
211212

212213
// Map the response to match our Query interface
213214
// Note: You may need to adjust this mapping based on the actual response structure
214-
return response.data.map((item: any) => ({
215+
return response.data.data.map((item: any) => ({
215216
id: item.id || item.qlQueryId,
216217
gid: item.qlQueryGid,
217218
name: item.qlQueryName,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function getEnvironments(): Promise<Environment[]> {
5858
);
5959

6060
// Return the data array directly from response.data
61-
return response.data || [];
61+
return response.data.data || [];
6262
} catch (error) {
6363
const errorMessage =
6464
error instanceof Error ? error.message : "Failed to fetch environments";
@@ -82,7 +82,7 @@ export async function getEnvironmentById(id: string): Promise<Environment> {
8282
throw new Error("Failed to fetch environment");
8383
}
8484

85-
return response.data;
85+
return response.data.data;
8686
} catch (error) {
8787
const errorMessage =
8888
error instanceof Error ? error.message : "Failed to fetch environment";

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy