Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Frontend
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
806
Merge Requests
54
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
84218941
Commit
84218941
authored
11 hours ago
by
Emiliano Balbuena
Browse files
Options
Download
(chore): Remove unused service dep
parent
f6fc084f
goal/pro-sso
1 merge request
!656
WIP: SSO for Pro sites
Pipeline
#96021706
failed with stages
in 31 minutes and 36 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
36 deletions
+32
-36
src/app/common/api/client.service.ts
View file @
84218941
import
{
Cookie
}
from
'
../../services/cookie
'
;
import
{
HttpClient
,
HttpHeaders
}
from
'
@angular/common/http
'
;
import
{
environment
}
from
'
../../../environments/environment
'
;
import
{
Location
}
from
'
@angular/common
'
;
import
{
SiteService
}
from
'
../services/site.service
'
;
/**
* API Class
...
...
@@ -11,11 +9,11 @@ export class MindsHttpClient {
base
:
string
=
'
/
'
;
cookie
:
Cookie
=
new
Cookie
();
static
_
(
http
:
HttpClient
,
site
:
SiteService
)
{
return
new
MindsHttpClient
(
http
,
site
);
static
_
(
http
:
HttpClient
)
{
return
new
MindsHttpClient
(
http
);
}
constructor
(
public
http
:
HttpClient
,
protected
site
:
SiteService
)
{}
constructor
(
public
http
:
HttpClient
)
{}
/**
* Return a GET request
...
...
This diff is collapsed.
src/app/common/common.module.ts
View file @
84218941
...
...
@@ -347,7 +347,7 @@ PlotlyModule.plotlyjs = PlotlyJS;
{
provide
:
MindsHttpClient
,
useFactory
:
MindsHttpClient
.
_
,
deps
:
[
HttpClient
,
SiteService
],
deps
:
[
HttpClient
],
},
{
provide
:
NSFWSelectorCreatorService
,
...
...
This diff is collapsed.
src/app/services/api/client.ts
View file @
84218941
...
...
@@ -2,7 +2,6 @@ import { Cookie } from '../cookie';
import
{
HttpClient
,
HttpHeaders
}
from
'
@angular/common/http
'
;
import
{
environment
}
from
'
../../../environments/environment
'
;
import
{
Location
}
from
'
@angular/common
'
;
import
{
SiteService
}
from
'
../../common/services/site.service
'
;
/**
* API Class
...
...
@@ -11,15 +10,11 @@ export class Client {
base
:
string
=
'
/
'
;
cookie
:
Cookie
=
new
Cookie
();
static
_
(
http
:
HttpClient
,
location
:
Location
,
site
:
SiteService
)
{
return
new
Client
(
http
,
location
,
site
);
static
_
(
http
:
HttpClient
,
location
:
Location
)
{
return
new
Client
(
http
,
location
);
}
constructor
(
public
http
:
HttpClient
,
public
location
:
Location
,
protected
site
:
SiteService
)
{}
constructor
(
public
http
:
HttpClient
,
public
location
:
Location
)
{}
/**
* Return a GET request
...
...
@@ -60,21 +55,23 @@ export class Client {
getRaw
(
endpoint
:
string
,
data
:
Object
=
{},
options
:
Object
=
{})
{
endpoint
+=
'
?
'
+
this
.
buildParams
(
data
);
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
http
.
get
(
this
.
base
+
endpoint
,
this
.
buildOptions
(
options
)).
subscribe
(
res
=>
{
return
resolve
(
res
);
},
err
=>
{
if
(
err
.
data
&&
!
err
.
data
())
{
return
reject
(
err
||
new
Error
(
'
GET error
'
));
}
if
(
err
.
status
===
401
&&
err
.
error
.
loggedin
===
false
)
{
window
.
location
.
href
=
'
/login
'
;
this
.
http
.
get
(
this
.
base
+
endpoint
,
this
.
buildOptions
(
options
,
true
))
.
subscribe
(
res
=>
{
return
resolve
(
res
);
},
err
=>
{
if
(
err
.
data
&&
!
err
.
data
())
{
return
reject
(
err
||
new
Error
(
'
GET error
'
));
}
if
(
err
.
status
===
401
&&
err
.
error
.
loggedin
===
false
)
{
window
.
location
.
href
=
'
/login
'
;
return
reject
(
err
);
}
return
reject
(
err
);
}
return
reject
(
err
);
}
);
);
});
}
...
...
@@ -122,7 +119,7 @@ export class Client {
postRaw
(
url
:
string
,
data
:
Object
=
{},
options
:
Object
=
{})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
http
.
post
(
url
,
JSON
.
stringify
(
data
),
this
.
buildOptions
(
options
))
.
post
(
url
,
JSON
.
stringify
(
data
),
this
.
buildOptions
(
options
,
true
))
.
subscribe
(
res
=>
{
var
data
:
any
=
res
;
...
...
@@ -227,7 +224,7 @@ export class Client {
/**
* Build the options
*/
private
buildOptions
(
options
:
Object
)
{
private
buildOptions
(
options
:
Object
,
withCredentials
:
boolean
=
false
)
{
const
XSRF_TOKEN
=
this
.
cookie
.
get
(
'
XSRF-TOKEN
'
)
||
''
;
const
headers
=
{
...
...
@@ -240,7 +237,9 @@ export class Client {
cache
:
true
,
};
builtOptions
[
'
withCredentials
'
]
=
true
;
if
(
withCredentials
)
{
builtOptions
[
'
withCredentials
'
]
=
true
;
}
return
Object
.
assign
(
options
,
builtOptions
);
}
...
...
This diff is collapsed.
src/app/services/api/upload.ts
View file @
84218941
import
{
Cookie
}
from
'
../cookie
'
;
import
{
HttpClient
}
from
'
@angular/common/http
'
;
import
{
SiteService
}
from
'
../../common/services/site.service
'
;
/**
* API Class
...
...
@@ -9,11 +8,11 @@ export class Upload {
base
:
string
=
'
/
'
;
cookie
:
Cookie
=
new
Cookie
();
static
_
(
http
:
HttpClient
,
site
:
SiteService
)
{
return
new
Upload
(
http
,
site
);
static
_
(
http
:
HttpClient
)
{
return
new
Upload
(
http
);
}
constructor
(
public
http
:
HttpClient
,
protected
site
:
SiteService
)
{}
constructor
(
public
http
:
HttpClient
)
{}
/**
* Return a POST request
...
...
This diff is collapsed.
src/app/services/providers.ts
View file @
84218941
...
...
@@ -67,12 +67,12 @@ export const MINDS_PROVIDERS: any[] = [
{
provide
:
Client
,
useFactory
:
Client
.
_
,
deps
:
[
HttpClient
,
Location
,
SiteService
],
deps
:
[
HttpClient
,
Location
],
},
{
provide
:
Upload
,
useFactory
:
Upload
.
_
,
deps
:
[
HttpClient
,
SiteService
],
deps
:
[
HttpClient
],
},
{
provide
:
Storage
,
...
...
This diff is collapsed.
Please
register
or
sign in
to comment