mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
(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:
parent
b3141e1a5f
commit
fb9fb3467d
2 changed files with 120 additions and 0 deletions
|
@ -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`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue