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
fc259cf9
Commit
fc259cf9
authored
Jul 08, 2017
by
Paul Reichelt
Committed by
Tim Neutkens
Jul 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send credentials with on-demand-entries-ping (#2509)
parent
a0d85d8b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
on-demand-entries-client.js
client/on-demand-entries-client.js
+6
-2
No files found.
client/on-demand-entries-client.js
View file @
fc259cf9
...
@@ -11,12 +11,16 @@ export default () => {
...
@@ -11,12 +11,16 @@ export default () => {
async
function
ping
()
{
async
function
ping
()
{
try
{
try
{
const
url
=
`/_next/on-demand-entries-ping?page=
${
Router
.
pathname
}
`
const
url
=
`/_next/on-demand-entries-ping?page=
${
Router
.
pathname
}
`
const
res
=
await
fetch
(
url
)
const
res
=
await
fetch
(
url
,
{
credentials
:
'same-origin'
})
const
payload
=
await
res
.
json
()
const
payload
=
await
res
.
json
()
if
(
payload
.
invalid
)
{
if
(
payload
.
invalid
)
{
// Payload can be invalid even if the page is not exists.
// Payload can be invalid even if the page is not exists.
// So, we need to make sure it's exists before reloading.
// So, we need to make sure it's exists before reloading.
const
pageRes
=
await
fetch
(
location
.
href
)
const
pageRes
=
await
fetch
(
location
.
href
,
{
credentials
:
'same-origin'
})
if
(
pageRes
.
status
===
200
)
{
if
(
pageRes
.
status
===
200
)
{
location
.
reload
()
location
.
reload
()
}
}
...
...
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