fix: add sdk as script

This commit is contained in:
Christel Westerberg
2024-02-07 15:10:02 +01:00
parent 70f7e95036
commit e48a9535ef
7 changed files with 62 additions and 38 deletions

View File

@@ -10,6 +10,7 @@ import Hero from "@/components/Current/Hero";
import type { PageArgs, LangParams, UriParams } from "@/types/params";
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage";
import ContentstackLivePreview from "@contentstack/live-preview-utils";
export default async function CurrentContentPage({
params,
@@ -17,6 +18,7 @@ export default async function CurrentContentPage({
}: PageArgs<LangParams, UriParams>) {
try {
console.log({ searchParams });
ContentstackLivePreview.setConfigFromParams(searchParams);
if (!searchParams.uri) {
throw new Error("Bad URI");
}
@@ -26,6 +28,10 @@ export default async function CurrentContentPage({
{ locale: params.lang, url: searchParams.uri }
);
if (!response) {
return <h1>No Hash recieved! Hash: {ContentstackLivePreview.hash}</h1>;
}
if (!response.data?.all_current_blocks_page?.total) {
console.log("#### DATA ####");
console.log(response.data);