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.

fix domain does not belong to project

Steven Tey72b51403b255
diff --git a/apps/web/lib/auth/index.ts b/apps/web/lib/auth/index.ts
index d2db503958..5d4d194798 100644
--- a/apps/web/lib/auth/index.ts
+++ b/apps/web/lib/auth/index.ts
@@ -182,24 +182,26 @@ export const withAuth =
},
};
// for demo links, we allow anonymous link creation
- } else if (allowAnonymous) {
- const project = await prisma.project.findUnique({
- where: {
- id: DUB_PROJECT_ID,
- },
- });
-
- return handler({
- req,
- params: params || {},
- searchParams,
- headers,
- // @ts-expect-error
- project,
- });
} else {
session = await getSession();
if (!session?.user?.id) {
+ if (allowAnonymous) {
+ const project = await prisma.project.findUnique({
+ where: {
+ id: DUB_PROJECT_ID,
+ },
+ });
+
+ return handler({
+ req,
+ params: params || {},
+ searchParams,
+ headers,
+ // @ts-expect-error
+ project,
+ });
+ }
+
return new Response("Unauthorized: Login required.", {
status: 401,
headers,