@@ -5,7 +5,7 @@ import { Component, EventEmitter, Output, AfterViewInit } from '@angular/core';
55import { AlertService } from '../../services/alert.service' ;
66import { ClaContributorService } from 'src/app/core/services/cla-contributor.service' ;
77import { ProjectModel } from 'src/app/core/models/project' ;
8- import { UserModel } from 'src/app/core/models/user' ;
8+ import { UserModel , UserFromTokenModel } from 'src/app/core/models/user' ;
99import { StorageService } from '../../services/storage.service' ;
1010import { AppSettings } from 'src/app/config/app-settings' ;
1111
@@ -20,6 +20,7 @@ export class ProjectTitleComponent implements AfterViewInit {
2020
2121 project = new ProjectModel ( ) ;
2222 user = new UserModel ( ) ;
23+ userFromToken = new UserFromTokenModel ( ) ;
2324
2425 constructor (
2526 private alertService : AlertService ,
@@ -67,9 +68,11 @@ export class ProjectTitleComponent implements AfterViewInit {
6768 getUserFromToken ( ) {
6869 this . claContributorService . getUserFromToken ( ) . subscribe (
6970 ( response ) => {
70- this . user = response ;
71- this . storageService . setItem ( AppSettings . USER_ID , this . user . userID ) ;
72- this . storageService . setItem ( AppSettings . USER , this . user ) ;
71+ this . userFromToken = response ;
72+ this . storageService . setItem ( AppSettings . USER_ID , this . userFromToken . userID ) ;
73+ // If we need to store all details in USER then add a helper method to
74+ // copy data from UserFromTokenModel to UserModel
75+ // this.storageService.setItem(AppSettings.USER, convertToUserModel(this.userFromToken));
7376 } ,
7477 ( exception ) => {
7578 this . errorEmitter . emit ( true ) ;
0 commit comments