build(ui/litellm-dashboard): ui cleanup

This commit is contained in:
Krrish Dholakia 2024-01-27 17:33:09 -08:00
parent c15f3559ca
commit 00a25ebfb8
8 changed files with 1135 additions and 129 deletions

View file

@ -2,7 +2,7 @@
* Helper file for calls being made to proxy
*/
export const createKeyCall = async (
export const keyCreateCall = async (
proxyBaseUrl: String,
accessToken: String,
userID: String
@ -27,9 +27,42 @@ export const createKeyCall = async (
const data = await response.json();
console.log(data);
return data;
// Handle success - you might want to update some state or UI based on the created key
} catch (error) {
console.error("Failed to create key:", error);
throw error;
}
};
export const keyDeleteCall = async (
proxyBaseUrl: String,
accessToken: String,
user_key: String
) => {
try {
const response = await fetch(`${proxyBaseUrl}/key/delete`, {
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
keys: [user_key],
}),
});
if (!response.ok) {
throw new Error("Network response was not ok");
}
const data = await response.json();
console.log(data);
return data;
// Handle success - you might want to update some state or UI based on the created key
} catch (error) {
console.error("Failed to create key:", error);
throw error;
}
};