File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed
shared/components/project-title Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,27 @@ export class UserModel {
1919 version : string ;
2020}
2121
22+ export class UserFromTokenModel {
23+ userID : string ;
24+ userExternalID ?: string ;
25+ username ?: string ;
26+ dateCreated ?: string | Date ;
27+ dateModified ?: string | Date ;
28+ lfEmail ?: string ;
29+ lfUsername ?: string ;
30+ companyID ?: string ;
31+ githubID ?: string ;
32+ githubUsername ?: string ;
33+ gitlabID ?: string ;
34+ gitlabUsername ?: string ;
35+ admin ?: boolean ;
36+ version ?: string ;
37+ note ?: string ;
38+ emails ?: string [ ] ;
39+ userCompanyID ?: string ;
40+ isSanctioned ?: boolean ;
41+ }
42+
2243export class UpdateUserModel {
2344 companyID : string ;
2445 dateCreated : Date ;
Original file line number Diff line number Diff line change @@ -60,6 +60,11 @@ export class ClaContributorService {
6060 return this . httpClient . get < UserModel > ( url ) ;
6161 }
6262
63+ getUserFromToken ( ) : Observable < UserFromTokenModel > {
64+ const url = this . getV4Endpoint ( '/v4/user-from-token' ) ;
65+ return this . httpClient . get < UserFromTokenModel > ( url ) ;
66+ }
67+
6368 updateUser ( data : any ) : Observable < UpdateUserModel > {
6469 const url = this . getV3Endpoint ( '/v3/users' ) ;
6570 return this . httpClient . put < UpdateUserModel > ( url , data ) ;
Original file line number Diff line number Diff line change @@ -64,6 +64,19 @@ export class ProjectTitleComponent implements AfterViewInit {
6464 }
6565 }
6666
67+ getUserFromToken ( ) {
68+ this . claContributorService . getUserFromToken ( ) . subscribe (
69+ ( response ) => {
70+ this . user = response ;
71+ this . storageService . setItem ( AppSettings . USER_ID , this . user . userID ) ;
72+ this . storageService . setItem ( AppSettings . USER , this . user ) ;
73+ } ,
74+ ( exception ) => {
75+ this . errorEmitter . emit ( true ) ;
76+ this . claContributorService . handleError ( exception ) ;
77+ }
78+ ) ;
79+ }
6780
6881 getUser ( ) {
6982 const userId = JSON . parse ( this . storageService . getItem ( AppSettings . USER_ID ) ) ;
@@ -84,4 +97,4 @@ export class ProjectTitleComponent implements AfterViewInit {
8497 this . alertService . error ( 'There is an invalid user ID in the URL' ) ;
8598 }
8699 }
87- }
100+ }
You can’t perform that action at this time.
0 commit comments