Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies to latest versions #85

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions ecommerce/app/[...page]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { builder } from "@builder.io/sdk";
import { RenderBuilderContent } from "@/src/components/builder";
import { builder } from '@builder.io/sdk';
import { RenderBuilderContent } from '@/src/components/builder';

builder.init(process.env.NEXT_PUBLIC_BUILDER_API_KEY!);

Expand All @@ -9,30 +9,37 @@ interface PageProps {
};
}

// export const revalidate = 500;

export default async function Page(props: PageProps) {
const builderModelName = "page";
let locale = "en-US";
const builderModelName = 'page';
let locale = 'en-US';

const content = await builder
// Get the page content from Builder with the specified options
.get(builderModelName, {
userAttributes: {
// Use the page path specified in the URL to fetch the content
urlPath: "/" + (props?.params?.page?.join("/") || ""),
locale,
urlPath: '/' + (props?.params?.page?.join('/') || ''),
// When content is localized through Targeting, the locale should be passed to the userAttributes
// As of Gen1 SDK v6.0.3 or Gen2 SDK v2.0.31, locale in either UserAttributes OR base options are checked for all locale features, and only one is needed
// locale: locale,
loggedIn: true,
},
locale
// When content is localized in-page, the locale should be passed directly to the options
locale: locale,
})
// Convert the result to a promise
.toPromise();

return (
<>
{/* Render the Builder page */}
<RenderBuilderContent locale={locale} content={content} model={builderModelName} options={{ enrich: true }}/>
<RenderBuilderContent
locale={locale}
content={content}
model={builderModelName}
options={{ enrich: true }}
data={{ username: 'user@builder' }}
/>
</>
);
}
}
Loading