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.

add workspaceId to response

Kiran K76b06c3d36f7
diff --git a/apps/web/app/api/links/info/route.ts b/apps/web/app/api/links/info/route.ts
index 38d49be062..5139af879a 100644
--- a/apps/web/app/api/links/info/route.ts
+++ b/apps/web/app/api/links/info/route.ts
@@ -9,7 +9,7 @@ import { NextResponse } from "next/server";
export const GET = withAuth(async ({ headers, searchParams }) => {
const { domain, key } = getLinkInfoQuerySchema.parse(searchParams);
- const response = await prisma.link.findUnique({
+ const link = await prisma.link.findUnique({
where: {
domain_key: {
domain,
@@ -21,7 +21,7 @@ export const GET = withAuth(async ({ headers, searchParams }) => {
},
});
- if (!response) {
+ if (!link) {
throw new DubApiError({
code: "not_found",
message: "Link not found.",
@@ -30,10 +30,11 @@ export const GET = withAuth(async ({ headers, searchParams }) => {
return NextResponse.json(
{
- ...response,
+ ...link,
+ workspaceId: `ws_${link.projectId}`,
shortLink: linkConstructor({
- domain: response.domain,
- key: response.key,
+ domain: link.domain,
+ key: link.key,
}),
},
{