Project

General

Profile

1
/**
2
 * Created by myrto on 11/24/17.
3
 */
4

    
5
import {Component, OnInit} from '@angular/core';
6
import {PiwikInfo} from '../../domain/typeScriptClasses';
7
import {ActivatedRoute, Router} from '@angular/router';
8
import { PiwikService } from '../../services/piwik.service';
9
import {AuthenticationService} from "../../services/authentication.service";
10

    
11
@Component ({
12
  selector: 'app-metrics-instructions',
13
  templateUrl: 'metrics-instructions.component.html'
14
})
15

    
16
export class MetricsInstructionsComponent implements OnInit {
17
  piwik: PiwikInfo;
18
  errorMessage: string;
19

    
20
  constructor(
21
    private route: ActivatedRoute,
22
    private router: Router,
23
    private piwikService: PiwikService,
24
    private authService: AuthenticationService) {}
25

    
26
  ngOnInit() {
27
    this.getPiwik();
28
  }
29

    
30
  getPiwik(): void {
31
    let id = this.route.snapshot.paramMap.get('id');
32
    this.piwikService.getPiwikInfo(id).subscribe(
33
      piwik => this.piwik = piwik,
34
      error => console.log(error),
35
      () => {
36
        /*if ( this.authService.getUserEmail() !== this.piwik.requestorEmail ) {
37
          this.router.navigateByUrl('/403-forbidden', { skipLocationChange: true });
38
        }*/
39
      }
40
    );
41
  }
42

    
43
}
(4-4/16)