Project

General

Profile

« Previous | Next » 

Revision 57061

[Connect]: Change user login check with user management service.

View differences:

user.component.ts
11 11
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
12 12
import {SubscribeComponent} from '../utils/subscribe/subscribe.component';
13 13
import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
14
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
14 15

  
15 16
@Component({
16 17
  selector: 'openaire-user',
......
53 54
  public server: boolean = true;
54 55
  loggedIn:boolean = false;
55 56
  constructor(private _subscribeService: SubscribeService,
56
              private _emailService: EmailService, private route: ActivatedRoute){}
57
              private _emailService: EmailService, private route: ActivatedRoute,
58
              private userManagementService: UserManagementService){}
57 59
  public ngOnInit() {
58
    if( typeof document !== 'undefined') {
59
      this.server = false;
60
      this.loggedIn = Session.isLoggedIn();
61
    }
62 60
    this.route.data
63 61
      .subscribe((data: { envSpecific: any }) => {
62
        this.userManagementService.isLoggedIn(data.envSpecific.userInfoUrl).subscribe( isLoggedIn => {
63
          if( typeof document !== 'undefined') {
64
            this.server = false;
65
            this.loggedIn = isLoggedIn;
66
          }
67
        });
64 68
        this.route.queryParams.subscribe(
65 69
          communityId => {
66 70
            this.communityId  = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);

Also available in: Unified diff