import {Component, Input} from '@angular/core'; import {Title, Meta} from '@angular/platform-browser'; import {User} from "../../login/utils/helper.class"; import {UserManagementService} from "../../services/user-management.service"; import {LoginErrorCodes} from "../../login/utils/guardHelper.class"; import {Router} from "@angular/router"; import {Subscriber} from "rxjs"; @Component({ selector: 'claims-admin', template: `
Manage links
`, }) export class ClaimsAdminComponent { @Input() fetchBy: string; @Input() fetchId: string; @Input() isConnect: boolean = false; @Input() externalPortalUrl: string; @Input() claimsInfoURL: string; @Input() userInfoURL: string; public user: User = null; sub; constructor(private _meta: Meta, private _title: Title, private userManagementService: UserManagementService, private _router: Router) { this._title.setTitle(this.isConnect?"OpenAIRE Connect | Manage links ":"OpenAIRE | Manage links "); } ngOnDestroy() { if (this.sub instanceof Subscriber) { this.sub.unsubscribe(); } } ngOnInit() { this.sub = this.userManagementService.getUserInfo().subscribe(user => { this.user = user; if (!user) { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url } }); } }); } }