From ec2d3b0d4d2669668953c6d4b6dbee9607da41c8 Mon Sep 17 00:00:00 2001 From: oguz ozturk Date: Sun, 11 Jan 2026 15:29:03 +0300 Subject: [PATCH] Fix: Company CF account flow - skip to NS setup directly --- frontend/src/components/AddDomainWizard.jsx | 26 +++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/AddDomainWizard.jsx b/frontend/src/components/AddDomainWizard.jsx index 1614377..b52b6e4 100644 --- a/frontend/src/components/AddDomainWizard.jsx +++ b/frontend/src/components/AddDomainWizard.jsx @@ -88,7 +88,7 @@ const AddDomainWizard = ({ onClose, onSuccess, customer }) => { }; // Step 2: Select CF account type - const handleStep2Next = () => { + const handleStep2Next = async () => { if (!cfAccountType) { setError('Please select a Cloudflare account option'); return; @@ -100,7 +100,29 @@ const AddDomainWizard = ({ onClose, onSuccess, customer }) => { } setError(null); - setCurrentStep(3); + + // If company account, create domain immediately and skip to step 4 + if (cfAccountType === 'company') { + setLoading(true); + try { + const response = await api.post('/api/customer/domains', { + domain_name: domainName, + cf_account_type: 'company', + cf_account_id: selectedCompanyAccount.id, + }); + + setDomainId(response.data.domain.id); + setDnsPreview(response.data.dns_preview); + setNsInstructions(response.data.ns_instructions); + setCurrentStep(4); // Skip step 3, go directly to NS setup + } catch (err) { + setError(err.response?.data?.error || 'Failed to create domain'); + } finally { + setLoading(false); + } + } else { + setCurrentStep(3); // Go to API token input + } }; // Step 3: Handle based on account type