From 1815ac04a1c055a051e8ad58a541aec485054f21 Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Tue, 23 Apr 2024 01:58:01 +0800 Subject: [PATCH] fix(next-drupal): use NextDrupalBase in enableDraftMode() Fixes #749 --- packages/next-drupal/src/draft.ts | 4 ++-- packages/next-drupal/tests/draft/draft.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/next-drupal/src/draft.ts b/packages/next-drupal/src/draft.ts index 39da1396..c47eba42 100644 --- a/packages/next-drupal/src/draft.ts +++ b/packages/next-drupal/src/draft.ts @@ -5,11 +5,11 @@ import { DRAFT_MODE_COOKIE_NAME, } from "./draft-constants" import type { NextRequest } from "next/server" -import type { NextDrupal } from "./next-drupal" +import type { NextDrupalBase } from "./next-drupal-base" export async function enableDraftMode( request: NextRequest, - drupal: NextDrupal + drupal: NextDrupalBase ): Promise { // Validate the draft request. const response = await drupal.validateDraftUrl(request.nextUrl.searchParams) diff --git a/packages/next-drupal/tests/draft/draft.test.ts b/packages/next-drupal/tests/draft/draft.test.ts index 61ab9d51..22296f40 100644 --- a/packages/next-drupal/tests/draft/draft.test.ts +++ b/packages/next-drupal/tests/draft/draft.test.ts @@ -12,7 +12,7 @@ import { NextRequest } from "next/server" import { DRAFT_DATA_COOKIE_NAME, DRAFT_MODE_COOKIE_NAME, - NextDrupal, + NextDrupalBase, } from "../../src" import { BASE_URL, spyOnFetch } from "../utils" import { @@ -50,7 +50,7 @@ describe("enableDraftMode()", () => { const request = new NextRequest( `https://example.com/api/draft?${searchParams}` ) - const drupal = new NextDrupal(BASE_URL) + const drupal = new NextDrupalBase(BASE_URL) const draftModeCookie: ResponseCookie = { name: DRAFT_MODE_COOKIE_NAME, value: "some-secret-key",