The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
redirect to /links when there is no links
Kiran K44ef0a5e78f5
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/auth.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/auth.tsxindex dd4aac05bb..516347c6e3 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/auth.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/auth.tsx@@ -2,13 +2,14 @@import useProgramEnrollment from "@/lib/swr/use-program-enrollment";import LayoutLoader from "@/ui/layout/layout-loader";-import { redirect, useParams } from "next/navigation";+import { redirect, useParams, usePathname } from "next/navigation";export function ProgramEnrollmentAuth({children,}: {children: React.ReactNode;}) {+ const pathname = usePathname();const { programSlug } = useParams();const { programEnrollment, error, loading } = useProgramEnrollment();@@ -23,5 +24,14 @@ export function ProgramEnrollmentAuth({redirect(`/programs/${programSlug}/apply`);}+ // Redirect to /links if no links found for a program enrollment+ if (+ programEnrollment &&+ programEnrollment.links?.length === 0 &&+ !pathname.endsWith("/links")+ ) {+ redirect(`/programs/${programSlug}/links`);+ }+return children;}