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 allowAnonymous...again

Steven Tey279b3bec1d12
diff --git a/apps/web/lib/auth/index.ts b/apps/web/lib/auth/index.ts
index 1cc674fb27..d2db503958 100644
--- a/apps/web/lib/auth/index.ts
+++ b/apps/web/lib/auth/index.ts
@@ -181,27 +181,25 @@ export const withAuth =
email: user.email || "",
},
};
+ // 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) {
- // for demo links, we allow anonymous link creation
- 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,