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.

fetch links from default folder

Kiran K82af0d15299a
diff --git a/apps/web/app/api/links/route.ts b/apps/web/app/api/links/route.ts
index e8cd28748b..a8b0b28a5f 100644
--- a/apps/web/app/api/links/route.ts
+++ b/apps/web/app/api/links/route.ts
@@ -22,7 +22,7 @@ import { NextResponse } from "next/server";
export const GET = withWorkspace(
async ({ headers, searchParams, workspace, session }) => {
const params = getLinksQuerySchemaExtended.parse(searchParams);
- const { domain, folderId, search, tagId, tagIds, tagNames, tenantId } =
+ let { domain, folderId, search, tagId, tagIds, tagNames, tenantId } =
params;
if (domain) {
@@ -37,6 +37,8 @@ export const GET = withWorkspace(
folderId,
requiredPermission: "folders.read",
});
+ } else {
+ folderId = workspace.defaultFolderId ?? undefined;
}
/* we only need to get the folder ids if we are:
@@ -61,6 +63,7 @@ export const GET = withWorkspace(
const response = await getLinksForWorkspace({
...params,
workspaceId: workspace.id,
+ folderId,
folderIds,
searchMode: selectedFolder?.type === "mega" ? "exact" : "fuzzy",
});