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
c98c7551
Commit
c98c7551
authored
Apr 23, 2025
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove Authorization header for API calls
parent
12d7b900
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
9 deletions
+0
-9
resources.ts
lib/api/resources.ts
+0
-5
useApiFetch.tsx
lib/api/useApiFetch.tsx
+0
-4
No files found.
lib/api/resources.ts
View file @
c98c7551
...
...
@@ -170,7 +170,6 @@ export interface ApiResource {
endpoint
?:
string
;
basePath
?:
string
;
pathParams
?:
Array
<
string
>
;
needAuth
?:
boolean
;
// for external APIs which require authentication
headers
?:
RequestInit
[
'
headers
'
];
}
...
...
@@ -214,7 +213,6 @@ export const RESOURCES = {
pathParams
:
[
'
chainId
'
as
const
,
'
type
'
as
const
],
endpoint
:
getFeaturePayload
(
config
.
features
.
verifiedTokens
)?.
api
.
endpoint
,
basePath
:
getFeaturePayload
(
config
.
features
.
verifiedTokens
)?.
api
.
basePath
,
needAuth
:
true
,
},
verified_addresses
:
{
...
...
@@ -222,7 +220,6 @@ export const RESOURCES = {
pathParams
:
[
'
chainId
'
as
const
],
endpoint
:
getFeaturePayload
(
config
.
features
.
verifiedTokens
)?.
api
.
endpoint
,
basePath
:
getFeaturePayload
(
config
.
features
.
verifiedTokens
)?.
api
.
basePath
,
needAuth
:
true
,
},
token_info_applications_config
:
{
...
...
@@ -230,7 +227,6 @@ export const RESOURCES = {
pathParams
:
[
'
chainId
'
as
const
],
endpoint
:
getFeaturePayload
(
config
.
features
.
addressVerification
)?.
api
.
endpoint
,
basePath
:
getFeaturePayload
(
config
.
features
.
addressVerification
)?.
api
.
basePath
,
needAuth
:
true
,
},
token_info_applications
:
{
...
...
@@ -238,7 +234,6 @@ export const RESOURCES = {
pathParams
:
[
'
chainId
'
as
const
,
'
id
'
as
const
],
endpoint
:
getFeaturePayload
(
config
.
features
.
addressVerification
)?.
api
.
endpoint
,
basePath
:
getFeaturePayload
(
config
.
features
.
addressVerification
)?.
api
.
basePath
,
needAuth
:
true
,
},
// AUTH
...
...
lib/api/useApiFetch.tsx
View file @
c98c7551
...
...
@@ -8,7 +8,6 @@ import config from 'configs/app';
import
isBodyAllowed
from
'
lib/api/isBodyAllowed
'
;
import
isNeedProxy
from
'
lib/api/isNeedProxy
'
;
import
{
getResourceKey
}
from
'
lib/api/useApiQuery
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
type
{
Params
as
FetchParams
}
from
'
lib/hooks/useFetch
'
;
import
useFetch
from
'
lib/hooks/useFetch
'
;
...
...
@@ -32,14 +31,11 @@ export default function useApiFetch() {
resourceName: R,
{
pathParams
,
queryParams
,
fetchParams
,
logError
}
: Params
<
R
>
=
{}
,
) =
>
{
const
apiToken
=
cookies
.
get
(
cookies
.
NAMES
.
API_TOKEN
);
const
resource
:
ApiResource
=
RESOURCES
[
resourceName
];
const
url
=
buildUrl
(
resourceName
,
pathParams
,
queryParams
);
const
withBody
=
isBodyAllowed
(
fetchParams
?.
method
);
const
headers
=
pickBy
({
'
x-endpoint
'
:
resource
.
endpoint
&&
isNeedProxy
()
?
resource
.
endpoint
:
undefined
,
Authorization
:
resource
.
endpoint
&&
resource
.
needAuth
?
apiToken
:
undefined
,
'
x-csrf-token
'
:
withBody
&&
csrfToken
?
csrfToken
:
undefined
,
...
resource
.
headers
,
...
fetchParams
?.
headers
,
...
...
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