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.

Delete matching unverified domain after registering new .link

Tim Wilson89acdf131318
diff --git a/apps/web/app/api/domains/register/route.ts b/apps/web/app/api/domains/register/route.ts
index 8a3f6c969a..d97951e7ef 100644
--- a/apps/web/app/api/domains/register/route.ts
+++ b/apps/web/app/api/domains/register/route.ts
@@ -53,6 +53,14 @@ export const POST = withWorkspace(
},
});
+ // Delete any matching unverified domain
+ await prisma.domain.delete({
+ where: {
+ slug,
+ verified: false,
+ },
+ });
+
await Promise.all([
// Create the workspace domain
prisma.domain.create({
diff --git a/apps/web/lib/dynadot/configure-dns.ts b/apps/web/lib/dynadot/configure-dns.ts
index d00fe07243..d8303819f9 100644
--- a/apps/web/lib/dynadot/configure-dns.ts
+++ b/apps/web/lib/dynadot/configure-dns.ts
@@ -27,7 +27,7 @@ export const configureDNS = async ({ domain }: { domain: string }) => {
);
if (!response.ok) {
- throw new Error(`Failed to register domain: ${response.statusText}`);
+ throw new Error(`Failed to configure domain DNS: ${response.statusText}`);
}
const data = schema.parse(await response.json());