Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Change update team to backend

Jakub Novak11f2ad9640d1
diff --git a/apps/web/src/components/Dashboard/Team.tsx b/apps/web/src/components/Dashboard/Team.tsx
index 312dee57c..022634513 100644
--- a/apps/web/src/components/Dashboard/Team.tsx
+++ b/apps/web/src/components/Dashboard/Team.tsx
@@ -16,6 +16,7 @@ interface TeamMember {
}
const teamUsersUrl = `${process.env.NEXT_PUBLIC_BILLING_API_URL}/teams/users`
+const teamUpdateNameUrl = `${process.env.NEXT_PUBLIC_BILLING_API_URL}/teams`
export const TeamContent = ({ team, user, teams, currentApiKey, setTeams, setCurrentTeam }: { team: Team, user: User, teams: Team[], currentApiKey: string | null, setTeams: (teams: Team[]) => void, setCurrentTeam: (team: Team) => void }) => {
const supabase = createPagesBrowserClient()
@@ -87,21 +88,25 @@ export const TeamContent = ({ team, user, teams, currentApiKey, setTeams, setCur
}
const changeTeamName = async () => {
- const { error } = await supabase
- .from('teams')
- .update({ name: teamName })
- .eq('id', team.id)
+ const res = await fetch(teamUpdateNameUrl, {
+ headers: {
+ 'X-Team-API-Key': currentApiKey!,
+ 'Content-Type': 'application/json',
+ },
+ method: 'PATCH',
+ body: JSON.stringify({ name: teamName }),
+ })
- if (error) {
- // TODO: Add sentry event here
+ if (!res.ok) {
toast({
title: 'An error occurred',
description: 'We were unable to change the team name',
})
- console.log(error)
+ console.log(res.statusText)
return
}
+
toast({
title: 'Team name changed',
})