Fix: Company CF account flow - skip to NS setup directly
This commit is contained in:
parent
045f46bce6
commit
ec2d3b0d4d
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue