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 { withError } from '@/utils/error';
|
||||||
import { getPageUrlParams } from '@/utils/url';
|
import { getPageUrlParams } from '@/utils/url';
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
import { headers } from 'next/headers';
|
||||||
|
|
||||||
export async function generateMetadata(pageProps: PageProps): Promise<Metadata> {
|
export async function generateMetadata(pageProps: PageProps): Promise<Metadata> {
|
||||||
const pageUrlParams = getPageUrlParams(pageProps);
|
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} | Эволюция`;
|
const text = `Условия: ${title} | Эволюция`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -24,7 +28,10 @@ export default async function Page(pageProps: PageProps) {
|
|||||||
return withError({
|
return withError({
|
||||||
render: async () => {
|
render: async () => {
|
||||||
const pageUrlParams = getPageUrlParams(pageProps);
|
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} />;
|
return <Conditions html={conditions} />;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -10,7 +10,10 @@ import { headers } from 'next/headers';
|
|||||||
|
|
||||||
export async function generateMetadata(pageProps: PageProps): Promise<Metadata> {
|
export async function generateMetadata(pageProps: PageProps): Promise<Metadata> {
|
||||||
const pageUrlParams = getPageUrlParams(pageProps);
|
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} | Эволюция`;
|
const text = `${title} | Эволюция`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user