'use client'; import React from 'react'; import {createClient} from "@/lib/supabase/server"; import AccountBillingStatus from "@/components/basejump/account-billing-status"; import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert"; const returnUrl = process.env.NEXT_PUBLIC_URL as string; type AccountParams = { accountSlug: string; }; export default function TeamBillingPage({ params }: { params: Promise }) { const unwrappedParams = React.use(params); const { accountSlug } = unwrappedParams; // Use an effect to load team account data const [teamAccount, setTeamAccount] = React.useState(null); const [error, setError] = React.useState(null); React.useEffect(() => { async function loadData() { try { const supabaseClient = await createClient(); const {data} = await supabaseClient.rpc('get_account_by_slug', { slug: accountSlug }); setTeamAccount(data); } catch (err) { setError("Failed to load account data"); console.error(err); } } loadData(); }, [accountSlug]); if (error) { return ( Error {error} ); } if (!teamAccount) { return
Loading...
; } if (teamAccount.account_role !== 'owner') { return ( Access Denied You do not have permission to access this page. ) } return (

Team Billing

Manage your team's subscription and billing details.

) }