(ui) edit teams

This commit is contained in:
Ishaan Jaff 2024-03-29 20:20:04 -07:00
parent 4a6aa3ee61
commit f62b3f5d2c
2 changed files with 73 additions and 19 deletions

View file

@ -817,6 +817,42 @@ export const teamCreateCall = async (
}
};
export const teamUpdateCall = async (
accessToken: string,
formValues: Record<string, any> // Assuming formValues is an object
) => {
try {
console.log("Form Values in teamUpateCall:", formValues); // Log the form values before making the API call
const url = proxyBaseUrl ? `${proxyBaseUrl}/team/update` : `/team/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 team: " + errorData);
console.error("Error response from the server:", errorData);
throw new Error("Network response was not ok");
}
const data = await response.json();
console.log("Update Team 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 create key:", error);
throw error;
}
};
export interface Member {
role: string;
user_id: string | null;