Files
pangolin/src/app/[orgId]/settings/domains/[domainId]/page.tsx
2026-04-20 14:57:24 -07:00

55 lines
1.4 KiB
TypeScript

import DomainPageClient from "@app/components/DomainPageClient";
import { GetDomainResponse } from "@server/routers/domain/getDomain";
import { internal } from "@app/lib/api";
import { authCookieHeader } from "@app/lib/api/cookies";
import { GetDNSRecordsResponse } from "@server/routers/domain";
import type { Metadata } from "next";
export const metadata: Metadata = {
title: "Domain"
};
interface DomainSettingsPageProps {
params: Promise<{ domainId: string; orgId: string }>;
}
export default async function DomainSettingsPage({
params
}: DomainSettingsPageProps) {
const { domainId, orgId } = await params;
let domain: GetDomainResponse | null = null;
try {
const res = await internal.get(
`/org/${orgId}/domain/${domainId}`,
await authCookieHeader()
);
domain = res.data.data;
} catch {
return null;
}
let dnsRecords: GetDNSRecordsResponse | null = null;
try {
const response = await internal.get(
`/org/${orgId}/domain/${domainId}/dns-records`,
await authCookieHeader()
);
dnsRecords = response.data.data;
} catch {
return null;
}
if (!domain || !dnsRecords) {
return null;
}
return (
<DomainPageClient
initialDomain={domain}
initialDnsRecords={dnsRecords}
orgId={orgId}
domainId={domainId}
/>
);
}