The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix stats bug for dub.sh links
Steven Teyc66087dfb03f
diff --git a/apps/web/app/api/stats/[endpoint]/route.ts b/apps/web/app/api/stats/[endpoint]/route.tsindex 950076c103..26c592f06a 100644--- a/apps/web/app/api/stats/[endpoint]/route.ts+++ b/apps/web/app/api/stats/[endpoint]/route.ts@@ -15,12 +15,17 @@ export const GET = withAuth(return new Response("Missing link domain.", { status: 400 });}- if (!project && !key) {+ // if there's no key and it's not a project, return 400+ // this is because projects can show stats for all links+ if (!key && !project) {return new Response("Missing link key.", { status: 400 });}- // return 403 if interval is 90d or all- if (project.plan === "free" && (interval === "all" || interval === "90d")) {+ // return 403 if project is on the free plan and interval is 90d or all+ if (+ project?.plan === "free" &&+ (interval === "all" || interval === "90d")+ ) {return new Response(`Require higher plan`, { status: 403 });}