diff --git a/js-sdk/integrations/react/next/app_router.mdx b/js-sdk/integrations/react/next/app_router.mdx index 9caf2154f..22e3673be 100644 --- a/js-sdk/integrations/react/next/app_router.mdx +++ b/js-sdk/integrations/react/next/app_router.mdx @@ -164,21 +164,21 @@ import { ALL_LANGUAGES, DEFAULT_LANGUAGE } from './shared'; const LANGUAGE_COOKIE = 'NEXT_LOCALE'; export async function setLanguage(locale: string) { - const cookieStore = cookies(); + const cookieStore = await cookies(); cookieStore.set(LANGUAGE_COOKIE, locale, { maxAge: 1000 * 60 * 60 * 24 * 365, // one year in milisecods }); } export async function getLanguage() { - const cookieStore = cookies(); + const cookieStore = await cookies(); const locale = cookieStore.get(LANGUAGE_COOKIE)?.value; if (locale && ALL_LANGUAGES.includes(locale)) { return locale; } // try to detect language from headers or use default - const detected = detectLanguageFromHeaders(headers(), ALL_LANGUAGES); + const detected = detectLanguageFromHeaders(await headers(), ALL_LANGUAGES); return detected || DEFAULT_LANGUAGE; } ```