2019-07-23 14:23:41 +02:00
|
|
|
import {Component} from '@angular/core';
|
|
|
|
import {ActivatedRoute} from '@angular/router';
|
2018-07-25 16:00:50 +02:00
|
|
|
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
|
2020-11-12 16:59:26 +01:00
|
|
|
import {Subscriber} from "rxjs";
|
2020-11-30 18:04:05 +01:00
|
|
|
import {properties} from "../../../environments/environment";
|
2018-01-26 16:00:07 +01:00
|
|
|
|
|
|
|
@Component({
|
2019-07-23 14:23:41 +02:00
|
|
|
selector: 'openaire-directLinking',
|
|
|
|
template: `
|
2023-07-13 10:48:23 +02:00
|
|
|
<directLinking [communityId]=communityId></directLinking>`
|
2018-01-26 16:00:07 +01:00
|
|
|
})
|
|
|
|
export class OpenaireDirectLinkingComponent {
|
2019-07-23 14:23:41 +02:00
|
|
|
communityId: string;
|
2020-11-12 16:59:26 +01:00
|
|
|
sub;
|
2018-07-25 16:00:50 +02:00
|
|
|
|
2023-07-13 10:48:23 +02:00
|
|
|
constructor(private route: ActivatedRoute) {}
|
2019-07-23 14:23:41 +02:00
|
|
|
|
2020-11-12 16:59:26 +01:00
|
|
|
ngOnDestroy() {
|
|
|
|
if (this.sub instanceof Subscriber) {
|
|
|
|
this.sub.unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
2019-07-23 14:23:41 +02:00
|
|
|
public ngOnInit() {
|
2023-07-13 10:48:23 +02:00
|
|
|
this.sub = this.route.queryParams.subscribe(
|
2019-07-23 14:23:41 +02:00
|
|
|
communityId => {
|
2020-11-30 18:04:05 +01:00
|
|
|
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
|
2019-07-23 14:23:41 +02:00
|
|
|
if (!this.communityId) {
|
|
|
|
this.communityId = communityId['communityId'];
|
|
|
|
}
|
2020-11-30 18:04:05 +01:00
|
|
|
});
|
2019-07-23 14:23:41 +02:00
|
|
|
}
|
2018-01-26 16:00:07 +01:00
|
|
|
}
|