diff --git a/client/src/components/domain/domain-details.tsx b/client/src/components/domain/domain-details.tsx index f774f31..cc38652 100644 --- a/client/src/components/domain/domain-details.tsx +++ b/client/src/components/domain/domain-details.tsx @@ -188,7 +188,14 @@ export function DomainDetails({ domain, onBack }: DomainDetailsProps) { providerId: domain.providerId }; + console.log("Updating record:", id, "with data:", updatedData); const res = await apiRequest("PUT", `/api/dns-records/${id}`, updatedData); + + if (!res.ok) { + const errorData = await res.json(); + throw new Error(errorData.message || "Failed to update record"); + } + return await res.json(); }, onSuccess: () => { @@ -201,9 +208,10 @@ export function DomainDetails({ domain, onBack }: DomainDetailsProps) { }); }, onError: (error) => { + console.error("Update record error:", error); toast({ title: "Failed to update record", - description: error.message, + description: error instanceof Error ? error.message : "Unknown error occurred", variant: "destructive", }); }, @@ -345,7 +353,6 @@ export function DomainDetails({ domain, onBack }: DomainDetailsProps) { Type Content TTL - Provider Last Update Status Actions @@ -394,7 +401,6 @@ export function DomainDetails({ domain, onBack }: DomainDetailsProps) { {record.ttl}s - {getProviderName(record.providerId)} {record.lastUpdated ? formatDistanceToNow(new Date(record.lastUpdated), { addSuffix: true }) @@ -409,6 +415,20 @@ export function DomainDetails({ domain, onBack }: DomainDetailsProps) { + + + + handleToggleActive(record, checked)} + className="mx-2" + /> + + + {record.isActive ? "Disable" : "Enable"} record + + +
{record.isActive ? "Disable" : "Enable"} record