Project

General

Profile

1 55210 k.triantaf
import {Component} from '@angular/core';
2 51407 argiro.kok
import {ActivatedRoute, Router}       from '@angular/router';
3
4 56621 k.triantaf
import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
5 51407 argiro.kok
6
@Component({
7 55210 k.triantaf
  selector: 'community-wrapper',
8
  template:`
9
      <community *ngIf="dashboard && communityId" [communityId]=communityId></community>
10
      <communities *ngIf="dashboard!=null && !dashboard" ></communities>
11
  `
12 51407 argiro.kok
})
13
14
export class CommunityWrapperComponent {
15
  communityId:string;
16
  dashboard:boolean = null;
17
18
  constructor (
19
      private route: ActivatedRoute,
20
      private _router: Router
21
22 55210 k.triantaf
  ) {
23
    this.route.data
24
        .subscribe((data: { envSpecific: any }) => {
25
          this.route.queryParams.subscribe(
26
              communityId => {
27 56331 konstantin
                this.communityId  = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
28
                if(!this.communityId) {
29
                  this.communityId = communityId['communityId'];
30 55210 k.triantaf
                }
31 56331 konstantin
32 55210 k.triantaf
                if(this.communityId){
33
                  this.dashboard = true;
34
                }else{
35
                  this.dashboard = false;
36
                }
37 51407 argiro.kok
38 55210 k.triantaf
              });
39
        });
40 51407 argiro.kok
41 55210 k.triantaf
  }
42
43 51407 argiro.kok
  public ngOnInit() {
44
  }
45
46
47
48
}