diff --git a/app/components/internet/pages/NicRegistrar.vue b/app/components/internet/pages/NicRegistrar.vue index ade0be7f5..71c9bec3a 100644 --- a/app/components/internet/pages/NicRegistrar.vue +++ b/app/components/internet/pages/NicRegistrar.vue @@ -2,6 +2,7 @@ import type { FormSubmitEvent } from '#ui/types'; import { z } from 'zod'; import type { Tab } from '~/store/internet'; +import type { TLD } from '~~/gen/ts/resources/internet/domain'; import type { CheckDomainAvailabilityResponse } from '~~/gen/ts/services/internet/domain'; const props = defineProps<{ @@ -27,18 +28,35 @@ function updateTabInfo(): void { updateTabInfo(); const schema = z.object({ + tldID: z.number().positive().min(1), search: z.string().max(40), }); type Schema = z.output; const state = reactive({ + tldID: 1, search: '', }); +const { data: tlds } = useLazyAsyncData('internet-tlds', () => listTLDs()); + +async function listTLDs(): Promise { + try { + const call = getGRPCInternetDomainsClient().listTLDs({}); + const { response } = await call; + + return response.tlds; + } catch (e) { + handleGRPCError(e as RpcError); + throw e; + } +} + async function checkDomainAvailability(values: Schema): Promise { try { const call = getGRPCInternetDomainsClient().checkDomainAvailability({ + tldId: 1, // TODO name: values.search, }); const { response } = await call; @@ -73,11 +91,23 @@ const onSubmitThrottle = useThrottleFn(async (event: FormSubmitEvent) =>