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.

framer redirects

Steven Teyfba9ecae3f8d
diff --git a/apps/web/lib/middleware/partners.ts b/apps/web/lib/middleware/partners.ts
index c679757fd6..b84fcb3669 100644
--- a/apps/web/lib/middleware/partners.ts
+++ b/apps/web/lib/middleware/partners.ts
@@ -23,6 +23,15 @@ export default async function PartnersMiddleware(req: NextRequest) {
);
if (!user && isAuthenticatedPath) {
+ const customAuthProgramSlug = ["framer"].find((p) =>
+ path.startsWith(`/programs/${p}`),
+ );
+ if (customAuthProgramSlug) {
+ return NextResponse.redirect(
+ new URL(`/${customAuthProgramSlug}/login`, req.url),
+ );
+ }
+
return NextResponse.redirect(
new URL(
`/login${path === "/" ? "" : `?next=${encodeURIComponent(fullPath)}`}`,
diff --git a/apps/web/ui/auth/login/framer-button.tsx b/apps/web/ui/auth/login/framer-button.tsx
index 2b6669aed0..3454ea5f2f 100644
--- a/apps/web/ui/auth/login/framer-button.tsx
+++ b/apps/web/ui/auth/login/framer-button.tsx
@@ -4,12 +4,9 @@ import { Button } from "@dub/ui";
import { cn } from "@dub/utils";
import { Framer } from "lucide-react";
import { signIn } from "next-auth/react";
-import { useSearchParams } from "next/navigation";
import { useState } from "react";
export const FramerButton = () => {
- const searchParams = useSearchParams();
- const next = searchParams?.get("next");
const [clicked, setClicked] = useState(false);
return (
@@ -19,7 +16,7 @@ export const FramerButton = () => {
onClick={() => {
setClicked(true);
signIn("framer", {
- ...(next && next.length > 0 ? { callbackUrl: next } : {}),
+ callbackUrl: "/programs/framer",
});
}}
icon={<Framer className="size-4 fill-white text-white" />}