diff --git a/examples/example-router-migration/app/[...slug]/page.tsx b/examples/example-router-migration/app/[...slug]/page.tsx index 4e61889c..5c7b7464 100644 --- a/examples/example-router-migration/app/[...slug]/page.tsx +++ b/examples/example-router-migration/app/[...slug]/page.tsx @@ -12,6 +12,7 @@ async function getNode(slug: string[]) { const params: JsonApiParams = {} + const isDraftMode = draftMode().isEnabled const draftData = getDraftData() if (draftData.path === path) { @@ -19,7 +20,9 @@ async function getNode(slug: string[]) { } // Translating the path also allows us to discover the entity type. - const translatedPath = await drupal.translatePath(path) + const translatedPath = await drupal.translatePath(path, { + withAuth: isDraftMode, + }) if (!translatedPath) { throw new Error("Resource not found", { cause: "NotFound" }) @@ -34,6 +37,7 @@ async function getNode(slug: string[]) { const resource = await drupal.getResource(type, uuid, { params, + withAuth: isDraftMode, }) if (!resource) { diff --git a/starters/basic-starter/app/[...slug]/page.tsx b/starters/basic-starter/app/[...slug]/page.tsx index 4e61889c..5c7b7464 100644 --- a/starters/basic-starter/app/[...slug]/page.tsx +++ b/starters/basic-starter/app/[...slug]/page.tsx @@ -12,6 +12,7 @@ async function getNode(slug: string[]) { const params: JsonApiParams = {} + const isDraftMode = draftMode().isEnabled const draftData = getDraftData() if (draftData.path === path) { @@ -19,7 +20,9 @@ async function getNode(slug: string[]) { } // Translating the path also allows us to discover the entity type. - const translatedPath = await drupal.translatePath(path) + const translatedPath = await drupal.translatePath(path, { + withAuth: isDraftMode, + }) if (!translatedPath) { throw new Error("Resource not found", { cause: "NotFound" }) @@ -34,6 +37,7 @@ async function getNode(slug: string[]) { const resource = await drupal.getResource(type, uuid, { params, + withAuth: isDraftMode, }) if (!resource) {