Merged in feature/refactor-lang (pull request #387)
feat: SW-238 Avoid prop drilling of lang Approved-by: Michael Zetterberg
This commit is contained in:
@@ -5,14 +5,18 @@ import { GetCurrentBlockPage } from "@/lib/graphql/Query/CurrentBlockPage.graphq
|
||||
|
||||
import ContentPage from "@/components/Current/ContentPage"
|
||||
import LoadingSpinner from "@/components/Current/LoadingSpinner"
|
||||
import { getLang, setLang } from "@/i18n/serverContext"
|
||||
|
||||
import type { LangParams, PageArgs, PreviewParams } from "@/types/params"
|
||||
import type { PageArgs, PreviewParams } from "@/types/params"
|
||||
import { LangParams } from "@/types/params"
|
||||
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
|
||||
|
||||
export default async function CurrentPreviewPage({
|
||||
params,
|
||||
searchParams,
|
||||
}: PageArgs<LangParams, PreviewParams>) {
|
||||
setLang(params.lang)
|
||||
|
||||
try {
|
||||
ContentstackLivePreview.setConfigFromParams(searchParams)
|
||||
|
||||
@@ -22,7 +26,7 @@ export default async function CurrentPreviewPage({
|
||||
|
||||
const response = await previewRequest<GetCurrentBlockPageData>(
|
||||
GetCurrentBlockPage,
|
||||
{ locale: params.lang, url: searchParams.uri }
|
||||
{ locale: getLang(), url: searchParams.uri }
|
||||
)
|
||||
|
||||
if (!response.data?.all_current_blocks_page?.total) {
|
||||
|
||||
Reference in New Issue
Block a user