mirror of
https://github.com/freedbygrace/DynamoDNS.git
synced 2026-07-27 03:48:56 +00:00
Checkpoint
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/79fe97ba-9acb-4084-b598-67aa27403958.jpg
This commit is contained in:
@@ -44,8 +44,13 @@ export function DomainTable({ onManageDomain, onDeleteDomain, onAddDomain }: Dom
|
||||
});
|
||||
|
||||
const getProviderName = (providerId: string | null | undefined) => {
|
||||
// Add enhanced debugging to help track down the issue
|
||||
console.log("Provider lookup - ID provided:", providerId, typeof providerId);
|
||||
console.log("Available providers:", providers.map(p => ({ id: p.id, name: p.name })));
|
||||
|
||||
// Handle completely empty providerId cases
|
||||
if (!providerId || providerId === "") {
|
||||
if (providerId === null || providerId === undefined || providerId === "") {
|
||||
console.log("Provider is empty/null");
|
||||
return "None";
|
||||
}
|
||||
|
||||
@@ -54,8 +59,10 @@ export function DomainTable({ onManageDomain, onDeleteDomain, onAddDomain }: Dom
|
||||
const provider = providers.find(p => p.id === providerId);
|
||||
|
||||
if (provider) {
|
||||
console.log("Found provider:", provider.name);
|
||||
return provider.name;
|
||||
} else {
|
||||
console.log("Provider not found for ID:", providerId);
|
||||
// If we have a providerId but can't find the provider (might be deleted)
|
||||
return "Unknown Provider";
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ export default function DomainsPage() {
|
||||
resolver: zodResolver(domainFormSchema),
|
||||
defaultValues: {
|
||||
name: "",
|
||||
providerId: undefined, // Explicitly set undefined to avoid empty string
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
@@ -89,11 +90,21 @@ export default function DomainsPage() {
|
||||
// Add domain mutation
|
||||
const addDomainMutation = useMutation({
|
||||
mutationFn: async (data: z.infer<typeof domainFormSchema>) => {
|
||||
// Prepare domain data with organizationId
|
||||
const domainData: InsertDomain = {
|
||||
...data,
|
||||
organizationId: currentOrganization?.id || "",
|
||||
};
|
||||
|
||||
// Add special handling for providerId
|
||||
// If providerId is an empty string or undefined, remove it completely
|
||||
// This ensures we don't send empty string which causes backend validation issues
|
||||
if (!domainData.providerId || domainData.providerId === "") {
|
||||
delete domainData.providerId; // Remove instead of setting to null to avoid type issues
|
||||
}
|
||||
|
||||
console.log("Submitting domain with provider:", domainData.providerId);
|
||||
|
||||
const res = await apiRequest("POST", "/api/domains", domainData);
|
||||
return await res.json();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user