mirror of
https://github.com/tiennm99/litellm.git
synced 2026-06-25 07:07:41 +00:00
Prevent navigation reset after team member operations (#12424)
* stay on member page when you delete or add a member * update member fix
This commit is contained in:
@@ -116,7 +116,8 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
|
||||
is_proxy_admin,
|
||||
userModels,
|
||||
editTeam,
|
||||
premiumUser = false
|
||||
premiumUser = false,
|
||||
onUpdate
|
||||
}) => {
|
||||
const [teamData, setTeamData] = useState<TeamData | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -163,7 +164,13 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
|
||||
message.success("Team member added successfully");
|
||||
setIsAddMemberModalVisible(false);
|
||||
form.resetFields();
|
||||
fetchTeamInfo();
|
||||
|
||||
// Fetch updated team info
|
||||
const updatedTeamData = await teamInfoCall(accessToken, teamId);
|
||||
setTeamData(updatedTeamData);
|
||||
|
||||
// Notify parent component of the update
|
||||
onUpdate(updatedTeamData);
|
||||
} catch (error: any) {
|
||||
let errMsg = "Failed to add team member";
|
||||
|
||||
@@ -198,7 +205,13 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
|
||||
|
||||
message.success("Team member updated successfully");
|
||||
setIsEditMemberModalVisible(false);
|
||||
fetchTeamInfo();
|
||||
|
||||
// Fetch updated team info
|
||||
const updatedTeamData = await teamInfoCall(accessToken, teamId);
|
||||
setTeamData(updatedTeamData);
|
||||
|
||||
// Notify parent component of the update
|
||||
onUpdate(updatedTeamData);
|
||||
} catch (error: any) {
|
||||
let errMsg = "Failed to update team member";
|
||||
if (error?.raw?.detail?.includes("Assigning team admins is a premium feature")) {
|
||||
@@ -222,10 +235,16 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await teamMemberDeleteCall(accessToken, teamId, member);
|
||||
await teamMemberDeleteCall(accessToken, teamId, member);
|
||||
|
||||
message.success("Team member removed successfully");
|
||||
fetchTeamInfo();
|
||||
|
||||
// Fetch updated team info
|
||||
const updatedTeamData = await teamInfoCall(accessToken, teamId);
|
||||
setTeamData(updatedTeamData);
|
||||
|
||||
// Notify parent component of the update
|
||||
onUpdate(updatedTeamData);
|
||||
} catch (error) {
|
||||
message.error("Failed to remove team member");
|
||||
console.error("Error removing team member:", error);
|
||||
|
||||
Reference in New Issue
Block a user