40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import * as apiIUS from '@/api/ius/query';
|
|
import { Conditions } from '@/components/Conditions';
|
|
import type { PageProps } from '@/types/page';
|
|
import { withError } from '@/utils/error';
|
|
import { getPageUrlParams } from '@/utils/url';
|
|
import type { Metadata } from 'next';
|
|
import { headers } from 'next/headers';
|
|
|
|
export async function generateMetadata(pageProps: PageProps): Promise<Metadata> {
|
|
const pageUrlParams = getPageUrlParams(pageProps);
|
|
const headersList = headers();
|
|
const cookie = headersList.get('cookie') ?? '';
|
|
|
|
const { title } = await apiIUS.getConfig({ cookie, pageUrlParams });
|
|
const text = `Условия: ${title} | Эволюция`;
|
|
|
|
return {
|
|
description: text,
|
|
openGraph: {
|
|
description: text,
|
|
title: text,
|
|
},
|
|
title: text,
|
|
};
|
|
}
|
|
|
|
export default async function Page(pageProps: PageProps) {
|
|
return withError({
|
|
render: async () => {
|
|
const pageUrlParams = getPageUrlParams(pageProps);
|
|
const headersList = headers();
|
|
const cookie = headersList.get('cookie') ?? '';
|
|
|
|
const conditions = await apiIUS.getConditions({ cookie, pageUrlParams });
|
|
|
|
return <Conditions html={conditions} />;
|
|
},
|
|
});
|
|
}
|