Skip to content

armgit / E2B

Public Imported from GitHub
0

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

fix account selector billing url retrieval

Ben Fornefeld673272efcf62
diff --git a/apps/web/src/app/(dashboard)/dashboard/page.tsx b/apps/web/src/app/(dashboard)/dashboard/page.tsx
index 4224bf658..9ef38e833 100644
--- a/apps/web/src/app/(dashboard)/dashboard/page.tsx
+++ b/apps/web/src/app/(dashboard)/dashboard/page.tsx
@@ -149,6 +149,7 @@ const Dashboard = ({ user }) => {
currentTeam={currentTeam}
setCurrentTeam={setCurrentTeam}
setTeams={setTeams}
+ domainState={domainState}
/>
<div className="flex-1 md:pl-10 pb-16">
<h2 className="text-2xl mb-2 font-bold">
@@ -178,6 +179,7 @@ const Sidebar = ({
currentTeam,
setCurrentTeam,
setTeams,
+ domainState,
}) => (
<div className="md:h-full md:w-48 space-y-2 pb-10 md:pb-0">
<AccountSelector
@@ -186,6 +188,7 @@ const Sidebar = ({
currentTeam={currentTeam}
setCurrentTeam={setCurrentTeam}
setTeams={setTeams}
+ domainState={domainState}
/>
<div className="flex flex-row justify-center space-x-4 md:space-x-0 md:space-y-2 md:flex-col">
diff --git a/apps/web/src/components/Dashboard/AccountSelector.tsx b/apps/web/src/components/Dashboard/AccountSelector.tsx
index 8d085a4b7..0ed941a4c 100644
--- a/apps/web/src/components/Dashboard/AccountSelector.tsx
+++ b/apps/web/src/components/Dashboard/AccountSelector.tsx
@@ -19,8 +19,7 @@ import {
} from '../ui/alert-dialog'
import { useState } from 'react'
import { Button } from '../Button'
-
-const createTeamUrl = `${process.env.NEXT_PUBLIC_BILLING_API_URL}/teams`
+import { getBillingUrl } from '@/app/(dashboard)/dashboard/utils'
export const AccountSelector = ({
teams,
@@ -28,13 +27,16 @@ export const AccountSelector = ({
currentTeam,
setCurrentTeam,
setTeams,
+ domainState,
}) => {
+ const [domain] = domainState
+
const [isDialogOpen, setIsDialogOpen] = useState(false)
const [teamName, setTeamName] = useState('')
const closeDialog = () => setIsDialogOpen(false)
const createNewTeam = async () => {
- const res = await fetch(createTeamUrl, {
+ const res = await fetch(getBillingUrl(domain, '/teams'), {
method: 'POST',
headers: {
'Content-Type': 'application/json',