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 + + + + )} + /> +