2023-11-09 20:59:20 +03:00

43 lines
996 B
TypeScript

import * as apiIUS from '@/api/ius/query';
import type { Request } from '@/api/ius/types';
import { Form } from '@/components/Form';
import type { Metadata } from 'next';
type Props = {
params: { slug: string };
searchParams: { [key: string]: string | string[] | undefined };
};
export async function generateMetadata({ params, searchParams }: Props): Promise<Metadata> {
const { title } = await apiIUS.getConfig({ searchParams, ...params });
const text = `${title} | Эволюция`;
return {
description: text,
openGraph: {
description: text,
title: text,
},
title: text,
};
}
export default async function Page(props: Props) {
const data = await getData({
searchParams: props.searchParams,
slug: props.params.slug,
});
return <Form {...data} />;
}
async function getData(params: Request) {
const data = await apiIUS.getData(params);
const metaData = await apiIUS.getMetaData(params);
return {
data,
metaData,
};
}