From d47ad4d3b7896fb27e5ed447947d3db77f64dac4 Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Thu, 10 Apr 2025 13:05:29 +0000 Subject: [PATCH] Enhance DNS record management by adding support for optional DNS providers. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/996e6e00-8df0-4e11-8054-4bedce75e1d8.jpg --- client/src/pages/dns-records.tsx | 49 +++++++++++++++++++++++++++++++- shared/schema.ts | 28 +++++++++++------- 2 files changed, 65 insertions(+), 12 deletions(-) diff --git a/client/src/pages/dns-records.tsx b/client/src/pages/dns-records.tsx index 82c92a7..bc4ef46 100644 --- a/client/src/pages/dns-records.tsx +++ b/client/src/pages/dns-records.tsx @@ -167,8 +167,12 @@ export default function DnsRecordsPage() { mutationFn: async (data: z.infer) => { if (!domainId) throw new Error("Domain ID is required"); + // Convert empty providerId to null + const providerId = data.providerId === "" ? null : data.providerId; + const recordData: InsertDnsRecord = { ...data, + providerId, domainId, }; @@ -199,7 +203,15 @@ export default function DnsRecordsPage() { // Update DNS record mutation const updateRecordMutation = useMutation({ mutationFn: async ({ id, data }: { id: string, data: z.infer }) => { - const res = await apiRequest("PUT", `/api/dns-records/${id}`, data); + // Convert empty providerId to null + const providerId = data.providerId === "" ? null : data.providerId; + + const updatedData = { + ...data, + providerId, + }; + + const res = await apiRequest("PUT", `/api/dns-records/${id}`, updatedData); return await res.json(); }, onSuccess: () => { @@ -730,6 +742,41 @@ export default function DnsRecordsPage() { )} /> + ( + + DNS Provider + + + Select the DNS provider to use for this record + + + + )} + /> +