apps/web: pass cookie to getConfig request
This commit is contained in:
parent
4d5ab7fd36
commit
dc1c315702
@ -4,10 +4,14 @@ 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 { title } = await apiIUS.getConfig({ pageUrlParams });
|
||||
const headersList = headers();
|
||||
const cookie = headersList.get('cookie') ?? '';
|
||||
|
||||
const { title } = await apiIUS.getConfig({ cookie, pageUrlParams });
|
||||
const text = `Условия: ${title} | Эволюция`;
|
||||
|
||||
return {
|
||||
@ -24,7 +28,10 @@ export default async function Page(pageProps: PageProps) {
|
||||
return withError({
|
||||
render: async () => {
|
||||
const pageUrlParams = getPageUrlParams(pageProps);
|
||||
const conditions = await apiIUS.getConditions({ pageUrlParams });
|
||||
const headersList = headers();
|
||||
const cookie = headersList.get('cookie') ?? '';
|
||||
|
||||
const conditions = await apiIUS.getConditions({ cookie, pageUrlParams });
|
||||
|
||||
return <Conditions html={conditions} />;
|
||||
},
|
||||
|
||||
@ -10,7 +10,10 @@ import { headers } from 'next/headers';
|
||||
|
||||
export async function generateMetadata(pageProps: PageProps): Promise<Metadata> {
|
||||
const pageUrlParams = getPageUrlParams(pageProps);
|
||||
const { title } = await apiIUS.getConfig({ pageUrlParams });
|
||||
const headersList = headers();
|
||||
const cookie = headersList.get('cookie') ?? '';
|
||||
|
||||
const { title } = await apiIUS.getConfig({ cookie, pageUrlParams });
|
||||
const text = `${title} | Эволюция`;
|
||||
|
||||
return {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user