The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update routes
Kiran K36d488dad9c7
diff --git a/apps/web/app/api/referrals/link/route.ts b/apps/web/app/api/referrals/link/route.tsindex 3a3ae10206..dd132f5ceb 100644--- a/apps/web/app/api/referrals/link/route.ts+++ b/apps/web/app/api/referrals/link/route.ts@@ -3,5 +3,15 @@ import { NextResponse } from "next/server";// GET /api/referrals/link - get the link for the given affiliateexport const GET = withAuth(async ({ link }) => {- return NextResponse.json(link);+ const { id, url, shortLink, clicks, leads, sales, saleAmount } = link;++ return NextResponse.json({+ id,+ url,+ shortLink,+ clicks,+ leads,+ sales,+ saleAmount,+ });});diff --git a/apps/web/app/api/referrals/program/route.ts b/apps/web/app/api/referrals/program/route.tsindex a18da727ac..bb7238dd34 100644--- a/apps/web/app/api/referrals/program/route.ts+++ b/apps/web/app/api/referrals/program/route.ts@@ -1,7 +1,8 @@import { withAuth } from "@/lib/referrals/auth";+import { ProgramSchema } from "@/lib/zod/schemas/partners";import { NextResponse } from "next/server";// GET /api/referrals/program - get the program for the given affiliateexport const GET = withAuth(async ({ program }) => {- return NextResponse.json(program);+ return NextResponse.json(ProgramSchema.parse(program));});diff --git a/apps/web/app/app.dub.co/embed/page-client.tsx b/apps/web/app/app.dub.co/embed/page-client.tsxindex 4892468856..26f4a89596 100644--- a/apps/web/app/app.dub.co/embed/page-client.tsx+++ b/apps/web/app/app.dub.co/embed/page-client.tsx@@ -15,8 +15,8 @@ import { useReferralProgram } from "./use-referral-program";export function ReferralsEmbedPageClient() {const { program } = useReferralProgram();- const [copied, copyToClipboard] = useCopyToClipboard();const { searchParamsObj } = useRouterStuff();+ const [copied, copyToClipboard] = useCopyToClipboard();const { link, isLoading: isLoadingLink } = useReferralLink();const {