Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
oser-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hamza Touizrat
oser-frontend
Merge requests
!57
Validated signup file display
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Validated signup file display
validated-signup-file-display
into
master
Overview
1
Commits
32
Pipelines
0
Changes
11
Merged
Validated signup file display
Hamza Touizrat
requested to merge
validated-signup-file-display
into
master
Nov 18, 2020
Overview
1
Commits
32
Pipelines
0
Changes
11
Created by: arthurgdn
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
bfc573ae
32 commits,
Jul 24, 2022
11 files
+
160
−
14
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
11
src/app/members/account/core/account-validation.service.ts
0 → 100644
+
69
−
0
View file @ bfc573ae
Edit in single-file editor
Open in Web IDE
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
HttpClient
}
from
'
@angular/common/http
'
;
import
{
Resolve
,
ActivatedRouteSnapshot
}
from
'
@angular/router
'
;
import
{
Observable
,
of
,
forkJoin
}
from
'
rxjs
'
;
import
{
tap
,
map
,
filter
,
catchError
}
from
'
rxjs/operators
'
;
import
{
ApiService
,
AuthService
,}
from
'
app/core
'
;
@
Injectable
({
providedIn
:
'
root
'
})
export
class
AccountValidationService
extends
ApiService
{
//api url
private
baseUrl
=
this
.
apiUrl
+
'
registrations
'
;
constructor
(
private
http
:
HttpClient
,
private
auth
:
AuthService
)
{
super
();
}
//get personalData by user
get
(
filters
:
any
):
Observable
<
String
>
{
const
url
=
this
.
baseUrl
;
return
this
.
http
.
get
(
url
,
{
params
:
filters
}).
pipe
(
map
((
data
:
any
)
=>
{
return
data
}),
);
}
retrieve
(
id
:
number
|
string
):
Observable
<
String
>
{
let
url
=
this
.
baseUrl
;
return
this
.
http
.
get
<
String
>
(
url
).
pipe
(
map
(
v
=>
{
console
.
log
(
'
validation
'
,
v
)
if
(
v
instanceof
Array
){
if
(
v
.
length
>
1
){
return
v
.
find
((
user
)
=>
user
.
user_id
===
id
).
validated
}
return
v
[
0
].
validated
}
}),
);
}
forUser
(
userId
:
number
):
Observable
<
String
>
{
return
this
.
get
({
user_id
:
String
(
userId
)});
}
}
@
Injectable
({
providedIn
:
'
root
'
})
export
class
AccountValidationResolver
implements
Resolve
<
String
>
{
constructor
(
private
service
:
AccountValidationService
,
private
auth
:
AuthService
)
{
}
//fetch registration status
resolve
(
route
:
ActivatedRouteSnapshot
):
Observable
<
String
>
{
const
user
=
this
.
auth
.
getUserSnapshot
();
return
this
.
service
.
retrieve
(
user
.
id
).
pipe
(
catchError
(
e
=>
of
(
null
))
);
}
}
Loading