Skip to content

Commit

Permalink
fix(next-drupal): use NextDrupalBase in enableDraftMode()
Browse files Browse the repository at this point in the history
Fixes #749
  • Loading branch information
JohnAlbin committed Apr 23, 2024
1 parent 3dd4b43 commit 1815ac0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/next-drupal/src/draft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Response | never> {
// Validate the draft request.
const response = await drupal.validateDraftUrl(request.nextUrl.searchParams)
Expand Down
4 changes: 2 additions & 2 deletions packages/next-drupal/tests/draft/draft.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 1815ac0

Please sign in to comment.