Files
tessera-ctl/apps/web/src/app/(portal)/modules/domaincheck/actions.ts
T
schalli 9f78580606
Tessera CI/CD / Lint & Type Check (push) Successful in 1m8s
Tessera CI/CD / Tests (push) Successful in 1m13s
Tessera CI/CD / Build & Deploy (push) Successful in 2m39s
feat(domaincheck): support all TLDs with suggestion alternatives
- Accept full domains (e.g. "example.xyz") not just labels
- Check the entered TLD as primary result
- Show .de, .com, .net, .org as alternative suggestions below
- Primary result highlighted with accent border
- Input without TLD still works (shows all 4 suggestions)
- Updated i18n placeholders and added "suggestions" label

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 14:54:30 +02:00

34 lines
823 B
TypeScript

const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001';
export interface DomainCheckResult {
tld: string;
fqdn: string;
status: 'available' | 'registered';
primary: boolean;
}
export interface DomainCheckResponse {
domain: string;
results: DomainCheckResult[];
}
export async function checkDomainAction(
domain: string,
): Promise<DomainCheckResponse> {
const response = await fetch(`${API_URL}/modules/domaincheck/check`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ domain }),
credentials: 'include',
});
if (!response.ok) {
const errorBody = await response.text().catch(() => '');
throw new Error(
`Domain check failed: ${response.status} ${errorBody}`.trim(),
);
}
return response.json();
}