mirror of
https://github.com/freedbygrace/DynamoDNS.git
synced 2026-08-31 12:48:03 +00:00
Improve DNS record management by simplifying provider ID handling.
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/519ee566-90cf-416d-9c50-a587156cc158.jpg
This commit is contained in:
@@ -142,7 +142,6 @@ export function DomainDetails({ domain, onBack }: DomainDetailsProps) {
|
|||||||
isActive: true,
|
isActive: true,
|
||||||
isAutoIP: false,
|
isAutoIP: false,
|
||||||
notes: "",
|
notes: "",
|
||||||
providerId: undefined,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -153,13 +152,10 @@ export function DomainDetails({ domain, onBack }: DomainDetailsProps) {
|
|||||||
const recordData: InsertDnsRecord = {
|
const recordData: InsertDnsRecord = {
|
||||||
...data,
|
...data,
|
||||||
domainId: domain.id,
|
domainId: domain.id,
|
||||||
|
// Inherit providerId from domain
|
||||||
|
providerId: domain.providerId
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle providerId - convert "none" to null
|
|
||||||
if (recordData.providerId === "none") {
|
|
||||||
recordData.providerId = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const res = await apiRequest("POST", "/api/dns-records", recordData);
|
const res = await apiRequest("POST", "/api/dns-records", recordData);
|
||||||
return await res.json();
|
return await res.json();
|
||||||
},
|
},
|
||||||
@@ -186,12 +182,13 @@ export function DomainDetails({ domain, onBack }: DomainDetailsProps) {
|
|||||||
mutationFn: async (data: z.infer<typeof dnsRecordSchema> & { id: string }) => {
|
mutationFn: async (data: z.infer<typeof dnsRecordSchema> & { id: string }) => {
|
||||||
const { id, ...updateData } = data;
|
const { id, ...updateData } = data;
|
||||||
|
|
||||||
// Handle providerId - convert "none" to null
|
// Always use domain's provider for the record
|
||||||
if (updateData.providerId === "none") {
|
const updatedData = {
|
||||||
updateData.providerId = null;
|
...updateData,
|
||||||
}
|
providerId: domain.providerId
|
||||||
|
};
|
||||||
|
|
||||||
const res = await apiRequest("PUT", `/api/dns-records/${id}`, updateData);
|
const res = await apiRequest("PUT", `/api/dns-records/${id}`, updatedData);
|
||||||
return await res.json();
|
return await res.json();
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
@@ -253,14 +250,13 @@ export function DomainDetails({ domain, onBack }: DomainDetailsProps) {
|
|||||||
// Set form values for editing
|
// Set form values for editing
|
||||||
form.reset({
|
form.reset({
|
||||||
name: record.name,
|
name: record.name,
|
||||||
type: record.type,
|
type: record.type as any, // Type cast to handle compatibility
|
||||||
content: record.content,
|
content: record.content,
|
||||||
ttl: record.ttl,
|
ttl: record.ttl as number, // Type cast to handle nullable
|
||||||
proxied: record.proxied,
|
proxied: record.proxied as boolean, // Type cast to handle nullable
|
||||||
isActive: record.isActive,
|
isActive: record.isActive,
|
||||||
isAutoIP: record.isAutoIP,
|
isAutoIP: record.isAutoIP,
|
||||||
notes: record.notes || "",
|
notes: record.notes || "",
|
||||||
providerId: record.providerId || "none",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setIsEditRecordDialogOpen(true);
|
setIsEditRecordDialogOpen(true);
|
||||||
@@ -304,7 +300,6 @@ export function DomainDetails({ domain, onBack }: DomainDetailsProps) {
|
|||||||
isActive: true,
|
isActive: true,
|
||||||
isAutoIP: false,
|
isAutoIP: false,
|
||||||
notes: "",
|
notes: "",
|
||||||
providerId: "none",
|
|
||||||
});
|
});
|
||||||
setIsAddRecordDialogOpen(true);
|
setIsAddRecordDialogOpen(true);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user