2019-07-23 14:23:12 +02:00
|
|
|
import {Component, Input} from '@angular/core';
|
2019-09-13 09:01:19 +02:00
|
|
|
import {User} from "../../login/utils/helper.class";
|
|
|
|
import {UserManagementService} from "../../services/user-management.service";
|
2020-03-26 13:18:18 +01:00
|
|
|
import {LoginErrorCodes} from "../../login/utils/guardHelper.class";
|
|
|
|
import {Router} from "@angular/router";
|
2020-11-11 15:43:13 +01:00
|
|
|
import {Subscriber} from "rxjs";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
@Component({
|
2019-07-23 14:23:12 +02:00
|
|
|
selector: 'my-claims',
|
|
|
|
template: `
|
2022-07-05 16:48:28 +02:00
|
|
|
<div class="uk-section">
|
|
|
|
<div class="uk-container uk-container-large">
|
|
|
|
<h1 class="uk-h2 uk-margin-remove">
|
|
|
|
My links
|
|
|
|
</h1>
|
|
|
|
<div class="uk-text-meta">
|
|
|
|
Manage your links in OpenAIRE
|
|
|
|
</div>
|
|
|
|
<div class="uk-margin-top">
|
|
|
|
<displayClaims *ngIf="user" [user]="user" [enableDelete]=true [myClaims]=true [isAdmin]=false [showUserEmail]=false
|
|
|
|
[claimsInfoURL]=claimsInfoURL [communityId]=communityId
|
|
|
|
[piwikSiteId]="piwikSiteId" pageTitle="My links">
|
|
|
|
</displayClaims>
|
2019-07-23 14:23:12 +02:00
|
|
|
</div>
|
2017-12-19 13:53:46 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-07-23 14:23:12 +02:00
|
|
|
`
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
})
|
2019-07-23 14:23:12 +02:00
|
|
|
export class MyClaimsComponent {
|
|
|
|
@Input() claimsInfoURL: string;
|
2019-07-24 17:46:49 +02:00
|
|
|
@Input() communityId:string;
|
2019-08-02 16:55:32 +02:00
|
|
|
@Input() piwikSiteId = null;
|
2019-09-13 09:01:19 +02:00
|
|
|
@Input() userInfoURL: string;
|
|
|
|
public user: User = null;
|
2018-06-29 13:01:48 +02:00
|
|
|
|
2020-03-26 13:18:18 +01:00
|
|
|
constructor(private userManagementService: UserManagementService, private _router: Router) {}
|
2019-07-23 14:23:12 +02:00
|
|
|
|
2020-11-11 15:43:13 +01:00
|
|
|
sub;
|
|
|
|
ngOnDestroy() {
|
|
|
|
if (this.sub instanceof Subscriber) {
|
|
|
|
this.sub.unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
2019-09-13 09:01:19 +02:00
|
|
|
ngOnInit() {
|
2020-11-11 15:43:13 +01:00
|
|
|
this.sub = this.userManagementService.getUserInfo().subscribe(user => {
|
2019-09-13 09:01:19 +02:00
|
|
|
this.user = user;
|
2020-03-26 13:18:18 +01:00
|
|
|
if (!user) {
|
|
|
|
this._router.navigate(['/user-info'], {
|
|
|
|
queryParams: {
|
|
|
|
"errorCode": LoginErrorCodes.NOT_VALID,
|
|
|
|
"redirectUrl": this._router.url
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-09-13 09:01:19 +02:00
|
|
|
});
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
}
|