import {Component} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";

@Component({
  selector: 'monitor-project',
  template: `
    <div id="page_content">
      <project *ngIf="initialized"></project>
    </div>`,
})
export class MonitorProjectComponent {
  initialized: boolean = false;
  
  constructor(private route: ActivatedRoute,
              private router: Router,
              private stakeholderService: StakeholderService) {
  }
  
  ngOnInit() {
    this.route.params.subscribe(params => {
      if (params['stakeholder']) {
        this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
          if (stakeholder) {
            this.initialized = true;
          }
        });
      }
    });
  }
}

