The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
optimize claim domain
Steven Tey3fbc36e6e547
diff --git a/apps/web/lib/api/domains/claim-dot-link-domain.ts b/apps/web/lib/api/domains/claim-dot-link-domain.tsindex 758a07e5b9..b5c718889d 100644--- a/apps/web/lib/api/domains/claim-dot-link-domain.ts+++ b/apps/web/lib/api/domains/claim-dot-link-domain.ts@@ -31,6 +31,13 @@ export async function claimDotLinkDomain({message: "Free workspaces cannot register .link domains.",});+ if (!workspace.stripeId) {+ throw new DubApiError({+ code: "forbidden",+ message: "You cannot register a .link domain on a free trial.",+ });+ }+if (workspace.id !== ACME_WORKSPACE_ID && workspace.dotLinkClaimed) {throw new DubApiError({code: "forbidden",diff --git a/apps/web/ui/domains/register-domain-form.tsx b/apps/web/ui/domains/register-domain-form.tsxindex b7f8d908c0..70e281b6a0 100644--- a/apps/web/ui/domains/register-domain-form.tsx+++ b/apps/web/ui/domains/register-domain-form.tsx@@ -129,6 +129,8 @@ export function RegisterDomainForm({<formonSubmit={async (e: FormEvent<HTMLFormElement>) => {e.preventDefault();+ // prevent the submission event from propagating to the parent form (in the link builder)+ e.stopPropagation();if (searchedDomain && searchedDomain.available) {await registerDomain(searchedDomain.domain);}