diff --git a/apps/web/src/app/app/consumers/[consumerId]/app-consumer-index.tsx b/apps/web/src/app/app/consumers/[consumerId]/app-consumer-index.tsx new file mode 100644 index 00000000..b80743c7 --- /dev/null +++ b/apps/web/src/app/app/consumers/[consumerId]/app-consumer-index.tsx @@ -0,0 +1,57 @@ +'use client' + +import { useQuery } from '@tanstack/react-query' + +import { useAuthenticatedAgentic } from '@/components/agentic-provider' +import { LoadingIndicator } from '@/components/loading-indicator' +import { toastError } from '@/lib/notifications' + +export function AppConsumerIndex({ consumerId }: { consumerId: string }) { + const ctx = useAuthenticatedAgentic() + const { + data: consumer, + isLoading, + isError + } = useQuery({ + queryKey: ['consumer', consumerId], + queryFn: () => + ctx!.api + .getConsumer({ + consumerId, + populate: ['project'] + }) + .catch((err: any) => { + void toastError( + `Failed to fetch customer subscription "${consumerId}"` + ) + throw err + }), + enabled: !!ctx + }) + + return ( + + {!ctx || isLoading ? ( + + ) : isError ? ( + Error fetching customer subscription "{consumerId}" + ) : !consumer ? ( + Customer subscription "{consumerId}" not found + ) : ( + <> + + Subscription to {consumer.project.name} + + + + {JSON.stringify(consumer, null, 2)} + + > + )} + + ) +} diff --git a/apps/web/src/app/app/consumers/[consumerId]/page.tsx b/apps/web/src/app/app/consumers/[consumerId]/page.tsx new file mode 100644 index 00000000..e290bfe9 --- /dev/null +++ b/apps/web/src/app/app/consumers/[consumerId]/page.tsx @@ -0,0 +1,13 @@ +import { AppConsumerIndex } from './app-consumer-index' + +export default async function AppConsumerIndexPage({ + params +}: { + params: Promise<{ + consumerId: string + }> +}) { + const { consumerId } = await params + + return +}
Error fetching customer subscription "{consumerId}"
Customer subscription "{consumerId}" not found
{JSON.stringify(consumer, null, 2)}