Skip to content

Commit 82ce3c3

Browse files
committed
add app enterprise methods
1 parent 19c99c7 commit 82ce3c3

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

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

+51
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,54 @@ export async function unconnectManagedWorkspace(orgGid: string) {
9090
throw err;
9191
}
9292
}
93+
94+
95+
96+
97+
// FOR APPS
98+
99+
export async function getManagedApps(environmentId: string) {
100+
const res = await axios.get(`/api/plugins/enterprise/app/list`);
101+
const allApps = res.data;
102+
return allApps.filter((app: any) => app.environmentId === environmentId);
103+
}
104+
105+
// Connect an app
106+
export async function connectManagedApp(
107+
environmentId: string,
108+
app_name: string,
109+
app_version: string,
110+
app_gid: string,
111+
app_tags: string[] = []
112+
) {
113+
try {
114+
const payload = {
115+
environment_id: environmentId,
116+
app_name,
117+
app_version,
118+
app_gid,
119+
app_tags,
120+
};
121+
122+
const res = await axios.post(`/api/plugins/enterprise/app`, payload);
123+
return res.data;
124+
} catch (err) {
125+
const errorMsg =
126+
err instanceof Error ? err.message : "Failed to connect app";
127+
message.error(errorMsg);
128+
throw err;
129+
}
130+
}
131+
132+
// Unconnect an app
133+
export async function unconnectManagedApp(appGid: string) {
134+
try {
135+
await axios.delete(`/api/plugins/enterprise/app`, {
136+
params: { appGid },
137+
});
138+
} catch (err) {
139+
const errorMsg = err instanceof Error ? err.message : "Failed to unconnect app";
140+
message.error(errorMsg);
141+
throw err;
142+
}
143+
}

0 commit comments

Comments
 (0)