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
!60
adds message for the format of phone number
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
adds message for the format of phone number
dev
into
master
Overview
1
Commits
6
Pipelines
0
Changes
13
Merged
Hamza Touizrat
requested to merge
dev
into
master
4 years ago
Overview
1
Commits
6
Pipelines
0
Changes
13
Created by: arthurgdn
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
00570cdc
6 commits,
2 years ago
13 files
+
174
−
21
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
13
src/app/members/account/core/account-validation.service.ts
0 → 100644
+
69
−
0
View file @ 00570cdc
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