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.

save expiredUrl and placeholder while adding domain

Kiran K0cae9588e463
diff --git a/apps/web/app/api/domains/route.ts b/apps/web/app/api/domains/route.ts
index 0270f3cb37..409e754ed4 100644
--- a/apps/web/app/api/domains/route.ts
+++ b/apps/web/app/api/domains/route.ts
@@ -31,7 +31,13 @@ export const GET = withAuth(async ({ workspace }) => {
// POST /api/domains - add a domain
export const POST = withAuth(async ({ req, workspace }) => {
- const { slug: domain, target, type } = await req.json();
+ const {
+ slug: domain,
+ target,
+ type,
+ expiredUrl,
+ placeholder,
+ } = await req.json();
if (workspace.domains.length >= workspace.domainsLimit) {
return new Response(
@@ -66,10 +72,14 @@ export const POST = withAuth(async ({ req, workspace }) => {
const response = await prisma.domain.create({
data: {
slug: domain,
- target,
type,
projectId: workspace.id,
primary: workspace.domains.length === 0,
+ placeholder,
+ ...(workspace.plan !== "free" && {
+ target,
+ expiredUrl,
+ }),
},
});