Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
vicotor
frontend
Commits
420bfd15
Commit
420bfd15
authored
Dec 29, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable node csrf fetch
parent
4ee004b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
Page.tsx
ui/shared/Page/Page.tsx
+4
-4
No files found.
ui/shared/Page/Page.tsx
View file @
420bfd15
...
@@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query';
...
@@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query';
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
useFetch
from
'
lib/hooks/useFetch
'
;
//
import useFetch from 'lib/hooks/useFetch';
import
AppError
from
'
ui/shared/AppError/AppError
'
;
import
AppError
from
'
ui/shared/AppError/AppError
'
;
import
ErrorBoundary
from
'
ui/shared/ErrorBoundary
'
;
import
ErrorBoundary
from
'
ui/shared/ErrorBoundary
'
;
import
PageContent
from
'
ui/shared/Page/PageContent
'
;
import
PageContent
from
'
ui/shared/Page/PageContent
'
;
...
@@ -23,10 +23,10 @@ const Page = ({
...
@@ -23,10 +23,10 @@ const Page = ({
hideMobileHeaderOnScrollDown
,
hideMobileHeaderOnScrollDown
,
isHomePage
,
isHomePage
,
}:
Props
)
=>
{
}:
Props
)
=>
{
const
customFetch
=
useFetch
();
//
const customFetch = useFetch();
useQuery
([
'
csrf
'
],
async
()
=>
{
useQuery
([
'
csrf
'
],
async
()
=>
{
const
nodeApiResponse
=
await
customFetch
(
'
/node-api/csrf
'
);
//
const nodeApiResponse = await customFetch('/node-api/csrf');
const
apiResponse
=
await
fetch
(
'
https://blockscout-main.test.aws-k8s.blockscout.com/api/account/v1/get_csrf
'
,
{
credentials
:
'
include
'
});
const
apiResponse
=
await
fetch
(
'
https://blockscout-main.test.aws-k8s.blockscout.com/api/account/v1/get_csrf
'
,
{
credentials
:
'
include
'
});
const
csrfFromHeader
=
apiResponse
.
headers
.
get
(
'
x-bs-account-csrf
'
);
const
csrfFromHeader
=
apiResponse
.
headers
.
get
(
'
x-bs-account-csrf
'
);
...
@@ -38,7 +38,7 @@ const Page = ({
...
@@ -38,7 +38,7 @@ const Page = ({
'
x-bs-account-csrf
'
:
csrfFromHeader
,
'
x-bs-account-csrf
'
:
csrfFromHeader
,
}
]);
}
]);
return
csrfFromHeader
?
{
token
:
csrfFromHeader
}
:
nodeApiResponse
;
return
csrfFromHeader
?
{
token
:
csrfFromHeader
}
:
undefined
;
},
{
},
{
enabled
:
Boolean
(
cookies
.
get
(
cookies
.
NAMES
.
API_TOKEN
)),
enabled
:
Boolean
(
cookies
.
get
(
cookies
.
NAMES
.
API_TOKEN
)),
});
});
...
...
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