1
|
/**
|
2
|
* Created by stefania on 10/3/16.
|
3
|
*/
|
4
|
import {Component, OnInit} from "@angular/core";
|
5
|
import {NavigationEnd, Router} from "@angular/router";
|
6
|
import { AuthenticationService } from './services/authentication.service';
|
7
|
|
8
|
@Component({
|
9
|
selector: 'openaire-dashboard',
|
10
|
templateUrl: './app.component.html',
|
11
|
})
|
12
|
|
13
|
export class AppComponent implements OnInit {
|
14
|
|
15
|
constructor(private router: Router,private authService: AuthenticationService) {
|
16
|
|
17
|
// URL of the SPA to redirect the user to after login
|
18
|
this.authService.redirectUrl = "/dashboard";
|
19
|
|
20
|
this.authService.tryLogin();
|
21
|
}
|
22
|
|
23
|
ngOnInit() {
|
24
|
this.router.events.subscribe((evt) => {
|
25
|
if (!(evt instanceof NavigationEnd)) {
|
26
|
return;
|
27
|
}
|
28
|
window.scrollTo(0, 0);
|
29
|
});
|
30
|
}
|
31
|
}
|