ui -edit model flow

This commit is contained in:
Ishaan Jaff 2024-04-24 13:21:22 -07:00
parent f8803cb877
commit 31a8270206

View file

@ -1015,6 +1015,41 @@ export const teamUpdateCall = async (
} }
}; };
export const modelUpdateCall = async (
accessToken: string,
formValues: Record<string, any> // Assuming formValues is an object
) => {
try {
console.log("Form Values in modelUpateCall:", formValues); // Log the form values before making the API call
const url = proxyBaseUrl ? `${proxyBaseUrl}/model/update` : `/model/update`;
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
...formValues, // Include formValues in the request body
}),
});
if (!response.ok) {
const errorData = await response.text();
message.error("Failed to update model: " + errorData, 20);
console.error("Error update from the server:", errorData);
throw new Error("Network response was not ok");
}
const data = await response.json();
console.log("Update model Response:", 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 update model:", error);
throw error;
}
};
export interface Member { export interface Member {
role: string; role: string;
user_id: string | null; user_id: string | null;