feat(03-02): add domaincheck frontend - input form, results display, i18n

- DomainInput component with text input and submit button
- ResultList component with green/red status badges (D-01)
- checkDomainAction fetches POST /modules/domaincheck/check with auth cookie
- Page renders within portal AppShell at /modules/domaincheck
- i18n keys added for both DE and EN locales
This commit is contained in:
2026-06-19 13:27:55 +02:00
parent 2e0a4ddc21
commit 1d9fd2280d
6 changed files with 231 additions and 0 deletions
@@ -0,0 +1,46 @@
/**
* Client-side action to check domain availability via the API.
*
* Calls POST /modules/domaincheck/check with the domain label.
* Auth cookie is forwarded via credentials: 'include'.
*/
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001';
export interface DomainCheckResult {
tld: string;
fqdn: string;
status: 'available' | 'registered';
}
export interface DomainCheckResponse {
domain: string;
results: DomainCheckResult[];
}
/**
* Check domain availability across TLD variants.
*
* @param domain - Base domain label (e.g., "example")
* @returns Response with domain and results array
* @throws Error if the API call fails
*/
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();
}