Skip to content

armgit / E2B

Public Imported from GitHub
0

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

update endpoints

ErikKaumk1bcd34b09e9f
diff --git a/apps/docs/src/app/(main)/dashboard/page.tsx b/apps/docs/src/app/(main)/dashboard/page.tsx
index 1444391cb..8ae509416 100644
--- a/apps/docs/src/app/(main)/dashboard/page.tsx
+++ b/apps/docs/src/app/(main)/dashboard/page.tsx
@@ -120,7 +120,7 @@ const MainContent = ({ selectedItem, user, team, currentApiKey }: { selectedItem
case 'personal':
return <PersonalContent user={user} />
case 'keys':
- return <KeysContent user={user} currentTeam={team} />
+ return <KeysContent user={user} currentTeam={team} currentApiKey={currentApiKey} />
case 'usage':
return <UsageContent currentApiKey={currentApiKey} />
case 'billing':
diff --git a/apps/docs/src/components/Button.tsx b/apps/docs/src/components/Button.tsx
index 2a9bc84d6..746498b09 100644
--- a/apps/docs/src/components/Button.tsx
+++ b/apps/docs/src/components/Button.tsx
@@ -38,7 +38,7 @@ const variantStyles = {
textTernary:
'text-yellow-500 hover:text-yellow-600 dark:text-yellow-400 dark:hover:text-yellow-500', // same as text, but gray-ish
desctructive:
- 'rounded-full py-1 px-3 text-red-700 ring-1 ring-inset ring-red-900/50 hover:bg-red-900/90 hover:text-red-900 dark:text-red-400 dark:ring-red/10 dark:hover:bg-red/50 dark:hover:text-red',
+ 'rounded-full py-1 px-3 text-red-700 ring-1 ring-inset ring-red-900/50 hover:bg-red-900/90 hover:ring-white/10 hover:text-red-900 dark:text-red-400 dark:ring-red/10 dark:hover:bg-red/50 dark:hover:text-red',
}
type ButtonProps = {
diff --git a/apps/docs/src/components/Dashboard/AccountSelector.tsx b/apps/docs/src/components/Dashboard/AccountSelector.tsx
index a82d861ba..b0e01209d 100644
--- a/apps/docs/src/components/Dashboard/AccountSelector.tsx
+++ b/apps/docs/src/components/Dashboard/AccountSelector.tsx
@@ -8,20 +8,24 @@ import {
import { ChevronRight, PlusCircle } from 'lucide-react'
import { toast } from '../ui/use-toast'
+const createTeamUrl = `${process.env.NEXT_PUBLIC_BILLING_API_URL}/teams`
+
export const AccountSelector = ({ teams, user, currentTeam, setCurrentTeam, setTeams }) => {
const createNewTeam = async() => {
- const res = await fetch('/api/create-new-team', {
+ const res = await fetch(createTeamUrl, {
method: 'POST',
headers: {
- 'Content-Type': 'application/json',
+ 'X-User-Access-Token': user.accessToken,
},
- body: JSON.stringify({ email: user.email, user_id: user.id })
})
if (!res.ok) {
+ // TODO: Add sentry event here
return
}
+
const data = await res.json()
+ console.log(data)
toast({
title: `Team ${data.team.name} created`,
diff --git a/apps/docs/src/components/Dashboard/Keys.tsx b/apps/docs/src/components/Dashboard/Keys.tsx
index 46f5d3eb8..11c31e581 100644
--- a/apps/docs/src/components/Dashboard/Keys.tsx
+++ b/apps/docs/src/components/Dashboard/Keys.tsx
@@ -18,8 +18,9 @@ import { createPagesBrowserClient } from '@supabase/auth-helpers-nextjs'
import { User } from '@supabase/supabase-js'
import { Team } from '@/utils/useUser'
+const createApiKeyUrl = `${process.env.NEXT_PUBLIC_BILLING_API_URL}/teams/api-keys`
-export const KeysContent = ({user, currentTeam}: {user: User, currentTeam: Team}) => {
+export const KeysContent = ({ user, currentTeam, currentApiKey }: { user: User, currentTeam: Team, currentApiKey: string | null}) => {
const supabase = createPagesBrowserClient()
const { toast } = useToast()
@@ -62,16 +63,21 @@ export const KeysContent = ({user, currentTeam}: {user: User, currentTeam: Team}
const addApiKey = async() => {
+ if (!currentApiKey) {
+ return
+ }
+
const teamId = currentTeam.id
- const res = await fetch('/api/create-api-key', {
+ const res = await fetch(createApiKeyUrl, {
method: 'POST',
headers: {
- 'Content-Type': 'application/json',
+ 'X-Team-API-Key': currentApiKey,
},
- body: JSON.stringify({ teamId }),
})
+
if (!res.ok) {
+ // TODO: Add sentry event here
return
}
@@ -81,7 +87,7 @@ export const KeysContent = ({user, currentTeam}: {user: User, currentTeam: Team}
title: 'API key created',
})
- setApiKeys([...apiKeys, {key: newKey.api_key, team_id: teamId, createdAt: newKey.created_at}])
+ setApiKeys([...apiKeys, {key: newKey.apiKey, team_id: teamId, createdAt: newKey.created_at}])
}
const copyToClipboard = (text: string) => {