mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-12 07:56:40 +00:00
initial setup for viewing domain details
This commit is contained in:
50
src/app/[orgId]/settings/domains/[domainId]/layout.tsx
Normal file
50
src/app/[orgId]/settings/domains/[domainId]/layout.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
import { internal } from "@app/lib/api";
|
||||
import { AxiosResponse } from "axios";
|
||||
import { redirect } from "next/navigation";
|
||||
import { authCookieHeader } from "@app/lib/api/cookies";
|
||||
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { GetDomainResponse } from "@server/routers/domain/getDomain";
|
||||
import DomainProvider from "@app/providers/DomainProvider";
|
||||
import DomainInfoCard from "@app/components/DomainInfoCard";
|
||||
|
||||
interface SettingsLayoutProps {
|
||||
children: React.ReactNode;
|
||||
params: Promise<{ domainId: string; orgId: string }>;
|
||||
}
|
||||
|
||||
export default async function SettingsLayout(props: SettingsLayoutProps) {
|
||||
const params = await props.params;
|
||||
|
||||
const { children } = props;
|
||||
|
||||
let domain = null;
|
||||
try {
|
||||
const res = await internal.get<AxiosResponse<GetDomainResponse>>(
|
||||
`/org/${params.orgId}/domain/${params.domainId}`,
|
||||
await authCookieHeader()
|
||||
);
|
||||
domain = res.data.data;
|
||||
console.log(JSON.stringify(domain));
|
||||
} catch {
|
||||
redirect(`/${params.orgId}/settings/domains`);
|
||||
}
|
||||
|
||||
const t = await getTranslations();
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<SettingsSectionTitle
|
||||
title={domain ? domain.baseDomain : t('domainSetting')}
|
||||
description={t('domainSettingDescription')}
|
||||
/>
|
||||
|
||||
<DomainProvider domain={domain}>
|
||||
<div className="space-y-6">
|
||||
<DomainInfoCard />
|
||||
</div>
|
||||
</DomainProvider>
|
||||
</>
|
||||
);
|
||||
}
|
||||
8
src/app/[orgId]/settings/domains/[domainId]/page.tsx
Normal file
8
src/app/[orgId]/settings/domains/[domainId]/page.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function DomainPage(props: {
|
||||
params: Promise<{ orgId: string; domainId: string }>;
|
||||
}) {
|
||||
const params = await props.params;
|
||||
redirect(`/${params.orgId}/settings/domains/${params.domainId}`);
|
||||
}
|
||||
Reference in New Issue
Block a user