Project

General

Profile

1
import {AuthenticationService} from "../../services/authentication.service";
2
import {Component, OnInit} from "@angular/core";
3
import {Router} from "@angular/router";
4
import { StatisticsService } from '../../services/statistics.service';
5

    
6
@Component ({
7
  selector: 'landing',
8
  templateUrl: 'landing.component.html'
9
})
10

    
11
export class LandingComponent implements OnInit {
12

    
13
  statisticsNumbers: Map<string,string>;
14
  inBeta: boolean;
15

    
16
  constructor(private authService: AuthenticationService,
17
              private statsService: StatisticsService,
18
              private router: Router) { }
19

    
20
  ngOnInit() {
21
    this.getStatisticsNumbers();
22

    
23
    const baseUrl = window.location.origin;
24
    this.inBeta = ( baseUrl.includes('beta') || baseUrl.includes('athenarc') );
25
  }
26

    
27

    
28
  login() {
29
    this.authService.loginWithState();
30
  }
31

    
32
  getStatisticsNumbers() {
33
    this.statsService.getStatisticsNumbers().subscribe(
34
      res => this.statisticsNumbers = res,
35
      error => console.log(error),
36
      () => console.log(JSON.stringify(this.statisticsNumbers))
37
    );
38
  }
39

    
40
  onStartHerePush() {
41
    this.router.navigate(['/dashboard']);
42
  }
43

    
44
  getIsUserLoggedIn() {
45
    return this.authService.getIsUserLoggedIn();
46
  }
47
}
(2-2/2)