Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
67fd72b7
Unverified
Commit
67fd72b7
authored
Mar 25, 2020
by
Yuji Matsumoto
Committed by
GitHub
Mar 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix preview-mode docs/examples typo (#11345)
be know => be known
parent
074c60e0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
4 deletions
+4
-4
preview-mode.md
docs/advanced-features/preview-mode.md
+1
-1
preview.js
examples/cms-datocms/pages/api/preview.js
+1
-1
preview.js
examples/cms-sanity/pages/api/preview.js
+1
-1
preview.js
examples/cms-takeshape/pages/api/preview.js
+1
-1
No files found.
docs/advanced-features/preview-mode.md
View file @
67fd72b7
...
@@ -74,7 +74,7 @@ Your headless CMS might allow you to include a variable in the preview URL so th
...
@@ -74,7 +74,7 @@ Your headless CMS might allow you to include a variable in the preview URL so th
```
js
```
js
export
default
async
(
req
,
res
)
=>
{
export
default
async
(
req
,
res
)
=>
{
// Check the secret and next parameters
// Check the secret and next parameters
// This secret should only be know to this API route and the CMS
// This secret should only be know
n
to this API route and the CMS
if
(
req
.
query
.
secret
!==
'MY_SECRET_TOKEN'
||
!
req
.
query
.
slug
)
{
if
(
req
.
query
.
secret
!==
'MY_SECRET_TOKEN'
||
!
req
.
query
.
slug
)
{
return
res
.
status
(
401
).
json
({
message
:
'Invalid token'
})
return
res
.
status
(
401
).
json
({
message
:
'Invalid token'
})
}
}
...
...
examples/cms-datocms/pages/api/preview.js
View file @
67fd72b7
...
@@ -2,7 +2,7 @@ import { getPreviewPostBySlug } from '../../lib/api'
...
@@ -2,7 +2,7 @@ import { getPreviewPostBySlug } from '../../lib/api'
export
default
async
(
req
,
res
)
=>
{
export
default
async
(
req
,
res
)
=>
{
// Check the secret and next parameters
// Check the secret and next parameters
// This secret should only be know to this API route and the CMS
// This secret should only be know
n
to this API route and the CMS
if
(
if
(
req
.
query
.
secret
!==
process
.
env
.
NEXT_EXAMPLE_CMS_DATOCMS_PREVIEW_SECRET
||
req
.
query
.
secret
!==
process
.
env
.
NEXT_EXAMPLE_CMS_DATOCMS_PREVIEW_SECRET
||
!
req
.
query
.
slug
!
req
.
query
.
slug
...
...
examples/cms-sanity/pages/api/preview.js
View file @
67fd72b7
...
@@ -2,7 +2,7 @@ import { getPreviewPostBySlug } from '../../lib/api'
...
@@ -2,7 +2,7 @@ import { getPreviewPostBySlug } from '../../lib/api'
export
default
async
(
req
,
res
)
=>
{
export
default
async
(
req
,
res
)
=>
{
// Check the secret and next parameters
// Check the secret and next parameters
// This secret should only be know to this API route and the CMS
// This secret should only be know
n
to this API route and the CMS
if
(
if
(
req
.
query
.
secret
!==
process
.
env
.
NEXT_EXAMPLE_CMS_SANITY_PREVIEW_SECRET
||
req
.
query
.
secret
!==
process
.
env
.
NEXT_EXAMPLE_CMS_SANITY_PREVIEW_SECRET
||
!
req
.
query
.
slug
!
req
.
query
.
slug
...
...
examples/cms-takeshape/pages/api/preview.js
View file @
67fd72b7
...
@@ -2,7 +2,7 @@ import { getPreviewPostBySlug } from '../../lib/api'
...
@@ -2,7 +2,7 @@ import { getPreviewPostBySlug } from '../../lib/api'
export
default
async
(
req
,
res
)
=>
{
export
default
async
(
req
,
res
)
=>
{
// Check the secret and next parameters
// Check the secret and next parameters
// This secret should only be know to this API route and the CMS
// This secret should only be know
n
to this API route and the CMS
if
(
if
(
req
.
query
.
secret
!==
req
.
query
.
secret
!==
process
.
env
.
NEXT_EXAMPLE_CMS_TAKESHAPE_PREVIEW_SECRET
||
process
.
env
.
NEXT_EXAMPLE_CMS_TAKESHAPE_PREVIEW_SECRET
||
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment