Skip to content

Commit a49f641

Browse files
authored
feat(next-drupal): remove unneeded previewSecret option/env variable
Fixes #661
1 parent d69ca0d commit a49f641

File tree

27 files changed

+20
-114
lines changed

27 files changed

+20
-114
lines changed

examples/example-blog/.env.example

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ NEXT_IMAGE_DOMAIN=localhost
33
DRUPAL_CLIENT_ID=52ce1a10-bf5c-4c81-8edf-eea3af95da84
44
DRUPAL_CLIENT_SECRET=SA9AGbHnx6pOamaAus2f9LG9XudHFjKs
55
DRUPAL_SITE_ID=1ccd4bc4-bbc6-4c19-a816-c7d100feff02
6-
DRUPAL_PREVIEW_SECRET=secret
7-
DRUPAL_FRONT_PAGE=/home
6+
DRUPAL_FRONT_PAGE=/home
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Required
22
NEXT_PUBLIC_DRUPAL_BASE_URL=http://localhost:8080
33
NEXT_IMAGE_DOMAIN=localhost
4-
DRUPAL_PREVIEW_SECRET=
54
DRUPAL_CLIENT_ID=
65
DRUPAL_CLIENT_SECRET=
76

87
# Optional
98
DRUPAL_SITE_ID=
109
DRUPAL_FRONT_PAGE=/home
11-
DRUPAL_JSONAPI_PREFIX=/jsonapi
10+
DRUPAL_JSONAPI_PREFIX=/jsonapi
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
# See https://next-drupal.org/docs/environment-variables
22
NEXT_PUBLIC_DRUPAL_BASE_URL=https://dev.next-drupal.org
33
NEXT_IMAGE_DOMAIN=dev.next-drupal.org
4-
5-
# Required for Preview Mode
6-
DRUPAL_PREVIEW_SECRET=secret

examples/example-graphql/lib/drupal.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export const drupal = new DrupalClient(
77
clientId: process.env.DRUPAL_CLIENT_ID,
88
clientSecret: process.env.DRUPAL_CLIENT_SECRET,
99
},
10-
previewSecret: process.env.DRUPAL_PREVIEW_SECRET,
1110
}
1211
)
1312

examples/example-graphql/pages/api/revalidate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NextApiRequest, NextApiResponse } from "next"
1+
import type { NextApiRequest, NextApiResponse } from "next"
22

33
export default async function handler(
44
request: NextApiRequest,
@@ -8,7 +8,7 @@ export default async function handler(
88
const secret = request.query.secret as string
99

1010
// Validate secret.
11-
if (secret !== process.env.DRUPAL_PREVIEW_SECRET) {
11+
if (secret !== process.env.DRUPAL_REVALIDATE_SECRET) {
1212
return response.status(401).json({ message: "Invalid secret." })
1313
}
1414

@@ -23,7 +23,7 @@ export default async function handler(
2323
return response.json({})
2424
} catch (error) {
2525
return response.status(404).json({
26-
message: error.message,
26+
message: (error as Error).message,
2727
})
2828
}
2929
}

examples/example-marketing/.env.example

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ NEXT_IMAGE_DOMAIN=localhost
33
DRUPAL_CLIENT_ID=52ce1a10-bf5c-4c81-8edf-eea3af95da84
44
DRUPAL_CLIENT_SECRET=SA9AGbHnx6pOamaAus2f9LG9XudHFjKs
55
DRUPAL_SITE_ID=example_marketing
6-
DRUPAL_PREVIEW_SECRET=secret
7-
DRUPAL_FRONT_PAGE=/home
6+
DRUPAL_FRONT_PAGE=/home

examples/example-marketing/lib/drupal.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export const drupal = new DrupalClient(
44
process.env.NEXT_PUBLIC_DRUPAL_BASE_URL,
55
{
66
frontPage: "/home",
7-
previewSecret: "secret",
87
auth: {
98
clientId: process.env.DRUPAL_CLIENT_ID,
109
clientSecret: process.env.DRUPAL_CLIENT_SECRET,

examples/example-marketing/pages/api/revalidate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NextApiRequest, NextApiResponse } from "next"
1+
import type { NextApiRequest, NextApiResponse } from "next"
22

33
export default async function handler(
44
request: NextApiRequest,
@@ -8,7 +8,7 @@ export default async function handler(
88
const secret = request.query.secret as string
99

1010
// Validate secret.
11-
if (secret !== process.env.DRUPAL_PREVIEW_SECRET) {
11+
if (secret !== process.env.DRUPAL_REVALIDATE_SECRET) {
1212
return response.status(401).json({ message: "Invalid secret." })
1313
}
1414

@@ -28,7 +28,7 @@ export default async function handler(
2828
return response.json({})
2929
} catch (error) {
3030
return response.status(404).json({
31-
message: error.message,
31+
message: (error as Error).message,
3232
})
3333
}
3434
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
NEXT_PUBLIC_DRUPAL_BASE_URL=http://localhost:8080
22
NEXT_IMAGE_DOMAIN=localhost
3-
DRUPAL_PREVIEW_SECRET=secret
43
NEXTAUTH_SECRET=
54
NEXTAUTH_URL=http://localhost:3000
65
DRUPAL_CLIENT_ID=
7-
DRUPAL_CLIENT_SECRET=
6+
DRUPAL_CLIENT_SECRET=
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
import { DrupalClient } from "next-drupal"
22

3-
export const drupal = new DrupalClient(
4-
process.env.NEXT_PUBLIC_DRUPAL_BASE_URL,
5-
{
6-
previewSecret: process.env.DRUPAL_PREVIEW_SECRET,
7-
}
8-
)
3+
export const drupal = new DrupalClient(process.env.NEXT_PUBLIC_DRUPAL_BASE_URL)

0 commit comments

Comments
 (0)