1 |
54479
|
myrto.kouk
|
import { Component, OnInit } from '@angular/core';
|
2 |
|
|
import { NavigationEnd, Router } from '@angular/router';
|
3 |
|
|
import { AuthenticationService } from './services/authentication.service';
|
4 |
|
|
import { environment } from '../environments/environment';
|
5 |
|
|
|
6 |
|
|
@Component({
|
7 |
|
|
selector: 'oa-repo-manager',
|
8 |
|
|
templateUrl: './app.component.html',
|
9 |
|
|
styleUrls: ['./app.component.css']
|
10 |
|
|
})
|
11 |
|
|
export class AppComponent implements OnInit {
|
12 |
|
|
piwikUrl: string;
|
13 |
|
|
|
14 |
|
|
constructor(private router: Router,
|
15 |
|
|
private authService: AuthenticationService) {
|
16 |
|
|
/*disabling console.log in production*/
|
17 |
|
|
if ( environment.production === true ) {
|
18 |
|
|
console.log = function () {};
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
// URL of the SPA to redirect the user to after login
|
22 |
|
|
// this.authService.redirectUrl = "/dashboard";
|
23 |
|
|
|
24 |
|
|
if (window.location.pathname.includes('/compatibility/browseHistory/')) {
|
25 |
|
|
this.authService.redirectUrl = window.location.pathname;
|
26 |
|
|
console.log('redirectUrl', this.authService.redirectUrl);
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
this.authService.tryLogin();
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
ngOnInit() {
|
33 |
54609
|
myrto.kouk
|
/*if ((window.location.origin).includes('beta') ||
|
34 |
54479
|
myrto.kouk
|
(window.location.origin).includes('athenarc') ) {
|
35 |
|
|
this.piwikUrl = 'https://analytics.openaire.eu/piwik.php?idsite=92&rec=1';
|
36 |
|
|
} else {
|
37 |
|
|
this.piwikUrl = 'https://analytics.openaire.eu/piwik.php?idsite=111&rec=1';
|
38 |
54609
|
myrto.kouk
|
}*/
|
39 |
54479
|
myrto.kouk
|
|
40 |
|
|
this.router.events.subscribe((evt) => {
|
41 |
|
|
if (!(evt instanceof NavigationEnd)) {
|
42 |
|
|
return;
|
43 |
|
|
}
|
44 |
|
|
window.scrollTo(0, 0);
|
45 |
|
|
});
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
}
|