The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
simplify getClickEvent
Steven Tey6958db1e0c64
diff --git a/apps/web/lib/tinybird/get-click-event.ts b/apps/web/lib/tinybird/get-click-event.tsindex 4f5d6d01e3..662bb1f260 100644--- a/apps/web/lib/tinybird/get-click-event.ts+++ b/apps/web/lib/tinybird/get-click-event.ts@@ -1,17 +1,14 @@import { clickEventSchemaTB } from "../zod/schemas/conversions";export async function getClickEvent(clickId: string) {- const url = new URL(- `${process.env.TINYBIRD_API_URL}/v0/pipes/click_by_id.json`,- );-- url.searchParams.append("clickId", clickId);-- const response = await fetch(url.toString(), {- headers: {- Authorization: `Bearer ${process.env.TINYBIRD_API_KEY}`,+ const response = await fetch(+ `${process.env.TINYBIRD_API_URL}/v0/pipes/click_by_id.json?clickId=${clickId}`,+ {+ headers: {+ Authorization: `Bearer ${process.env.TINYBIRD_API_KEY}`,+ },},- });+ );if (!response.ok) {console.error("Error fetching click event from Tinybird", response);