Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

some cleanup

Kiran K1e38bd6ff230
diff --git a/apps/web/app/api/webhooks/[webhookId]/events/route.ts b/apps/web/app/api/webhooks/[webhookId]/events/route.ts
index 31649831e0..c24fe765f5 100644
--- a/apps/web/app/api/webhooks/[webhookId]/events/route.ts
+++ b/apps/web/app/api/webhooks/[webhookId]/events/route.ts
@@ -15,18 +15,16 @@ export const GET = withWorkspace(
},
});
- // TODO:
- // 1. Filter events by url, workspace, event type, http status
- // 2. Paginate events
- // 3. Sort events by createdAt
-
const events = await getWebhookEvents({
webhookId,
});
- // console.log(events);
+ const parsedEvents = events.data.map((event) => ({
+ ...event,
+ request_body: JSON.parse(event.request_body),
+ }));
- return NextResponse.json(events.data);
+ return NextResponse.json(parsedEvents);
},
{
requiredPermissions: ["webhooks.read"],
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/[webhookId]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/[webhookId]/page-client.tsx
index 5dd2248ab4..9c7e57a827 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/[webhookId]/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/[webhookId]/page-client.tsx
@@ -36,9 +36,6 @@ export default function WebhookLogsPageClient({
},
);
- // TODO: Get total events from API
- const totalEvents = events?.length || 100;
-
return (
<>
<WebhookHeader webhookId={webhookId} page="events" />
@@ -48,7 +45,7 @@ export default function WebhookLogsPageClient({
) : events && events.length === 0 ? (
<NoEventsPlaceholder />
) : (
- <WebhookEventList totalEvents={totalEvents} events={events || []} />
+ <WebhookEventList events={events || []} />
)}
</MaxWidthWrapper>
</>
diff --git a/apps/web/ui/webhooks/webhook-events.tsx b/apps/web/ui/webhooks/webhook-events.tsx
index 41c50e8929..42cae1eb18 100644
--- a/apps/web/ui/webhooks/webhook-events.tsx
+++ b/apps/web/ui/webhooks/webhook-events.tsx
@@ -6,12 +6,11 @@ import { PropsWithChildren } from "react";
export type EventListProps = PropsWithChildren<{
events: WebhookEventProps[];
- totalEvents: number;
}>;
const isSuccess = (status: number) => status >= 200 && status < 300;
-export function WebhookEventList({ events, totalEvents }: EventListProps) {
+export function WebhookEventList({ events }: EventListProps) {
return (
<div className="rounded-xl border border-gray-200">
{/* Webhook Events */}