Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
synergy-components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
synergy-components
Commits
6342dc30
Commit
6342dc30
authored
Apr 27, 2026
by
Samir Sadyhov
🤔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ApiClient добавлена авторизация дофолтного юзера конструктора
parent
d2dcc2ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
constructor/library/ApiClient.js
constructor/library/ApiClient.js
+13
-2
No files found.
constructor/library/ApiClient.js
View file @
6342dc30
...
...
@@ -2,14 +2,15 @@ this.ApiClient = class {
constructor
()
{
this
.
_baseURL
=
`
${
window
.
location
.
origin
}
/Synergy`
;
this
.
_authHeader
=
this
.
_buildAuthHeader
();
this
.
_defaultAuthHeader
=
this
.
_buildDefaultAuthHeader
();
this
.
_requestInterceptors
=
[];
this
.
_responseInterceptors
=
[];
}
async
request
({
url
,
method
=
'
GET
'
,
body
,
headers
=
{}
})
{
async
request
({
url
,
method
=
'
GET
'
,
body
,
headers
=
{}
,
defaultUser
=
false
})
{
let
finalHeaders
=
this
.
_normalizeHeaders
({
authorization
:
this
.
_authHeader
,
authorization
:
defaultUser
?
this
.
_defaultAuthHeader
:
this
.
_authHeader
,
...
headers
,
});
...
...
@@ -104,6 +105,16 @@ this.ApiClient = class {
}
}
_buildDefaultAuthHeader
()
{
const
{
defaultUser
,
defaultUserPassword
}
=
Cons
.
getCurrentApp
();
const
base64
=
btoa
(
new
TextEncoder
().
encode
(
`
${
defaultUser
}
:
${
defaultUserPassword
}
`
)
.
reduce
((
str
,
byte
)
=>
str
+
String
.
fromCharCode
(
byte
),
''
)
);
return
`Basic
${
base64
}
`
;
}
_normalizeHeaders
(
headers
=
{})
{
const
result
=
{};
for
(
const
key
in
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