(UI) Delete Internal Users on Admin UI (#6442)

* add /user/delete call

* ui show modal asking if you want to delete user

* fix delete user modal
This commit is contained in:
Ishaan Jaff 2024-10-26 11:41:37 +04:00 committed by GitHub
parent b3141e1a5f
commit fb9fb3467d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 120 additions and 0 deletions

View file

@ -521,6 +521,39 @@ export const keyDeleteCall = async (accessToken: String, user_key: String) => {
}
};
export const userDeleteCall = async (accessToken: string, userIds: string[]) => {
try {
const url = proxyBaseUrl ? `${proxyBaseUrl}/user/delete` : `/user/delete`;
console.log("in userDeleteCall:", userIds);
const response = await fetch(url, {
method: "POST",
headers: {
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
user_ids: userIds,
}),
});
if (!response.ok) {
const errorData = await response.text();
handleError(errorData);
throw new Error("Network response was not ok");
}
const data = await response.json();
console.log(data);
//message.success("User(s) Deleted");
return data;
} catch (error) {
console.error("Failed to delete user(s):", error);
throw error;
}
};
export const teamDeleteCall = async (accessToken: String, teamID: String) => {
try {
const url = proxyBaseUrl ? `${proxyBaseUrl}/team/delete` : `/team/delete`;