fix: add sdk as script
This commit is contained in:
@@ -8,15 +8,13 @@ import SkipToMainContent from "@/components/SkipToMainContent";
|
||||
|
||||
import type { Metadata } from "next";
|
||||
import type { LangParams, LayoutArgs } from "@/types/params";
|
||||
import ContentstackLivePreview from "@contentstack/live-preview-utils";
|
||||
import InitLivePreview from "@/components/Current/LivePreview";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
description: "New web",
|
||||
title: "Scandic Hotels New Web",
|
||||
};
|
||||
|
||||
ContentstackLivePreview.init();
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
params,
|
||||
@@ -24,10 +22,10 @@ export default function RootLayout({
|
||||
return (
|
||||
<html lang={params.lang}>
|
||||
<head>
|
||||
<Script
|
||||
{/* <Script
|
||||
data-cookieconsent="ignore"
|
||||
src="/Static/dist/js/head.js?85c84c9e24ae8da3e7af"
|
||||
/>
|
||||
/> */}
|
||||
<Script
|
||||
data-cookieconsent="ignore"
|
||||
src="/Static/dist/js/inline.js?00133e5a37de35c51a5d"
|
||||
@@ -48,13 +46,14 @@ export default function RootLayout({
|
||||
data-cookieconsent="ignore"
|
||||
src="/Static/dist/js/ng/main.js?1705409330990"
|
||||
/>
|
||||
<Script
|
||||
{/* <Script
|
||||
data-cookieconsent="ignore"
|
||||
src="/Static/dist/js/main-ng.js?336b801d6b38eff10884"
|
||||
strategy="lazyOnload"
|
||||
/>
|
||||
/> */}
|
||||
</head>
|
||||
<body>
|
||||
<InitLivePreview />
|
||||
<LangPopup lang={params.lang} />
|
||||
<SkipToMainContent lang={params.lang} />
|
||||
{children}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user