forked from phoenix/litellm-mirror
(UI) pas form values to API
This commit is contained in:
parent
3c9458cd17
commit
6e9843baee
1 changed files with 10 additions and 4 deletions
|
@ -3,11 +3,13 @@
|
|||
*/
|
||||
|
||||
export const keyCreateCall = async (
|
||||
proxyBaseUrl: String,
|
||||
accessToken: String,
|
||||
userID: String
|
||||
proxyBaseUrl: string,
|
||||
accessToken: string,
|
||||
userID: string,
|
||||
formValues: Record<string, any> // Assuming formValues is an object
|
||||
) => {
|
||||
try {
|
||||
console.log("Form Values in keyCreateCall:", formValues); // Log the form values before making the API call
|
||||
const response = await fetch(`${proxyBaseUrl}/key/generate`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
@ -16,15 +18,18 @@ export const keyCreateCall = async (
|
|||
},
|
||||
body: JSON.stringify({
|
||||
user_id: userID,
|
||||
...formValues, // Include formValues in the request body
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json();
|
||||
console.error("Error response from the server:", errorData);
|
||||
throw new Error("Network response was not ok");
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
console.log("API Response:", data);
|
||||
return data;
|
||||
// Handle success - you might want to update some state or UI based on the created key
|
||||
} catch (error) {
|
||||
|
@ -33,6 +38,7 @@ export const keyCreateCall = async (
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
export const keyDeleteCall = async (
|
||||
proxyBaseUrl: String,
|
||||
accessToken: String,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue