1
|
import {Component, Input} from '@angular/core';
|
2
|
import {User} from "../../login/utils/helper.class";
|
3
|
import {UserManagementService} from "../../services/user-management.service";
|
4
|
import {LoginErrorCodes} from "../../login/utils/guardHelper.class";
|
5
|
import {Router} from "@angular/router";
|
6
|
import {Subscriber} from "rxjs";
|
7
|
|
8
|
@Component({
|
9
|
selector: 'my-claims',
|
10
|
template: `
|
11
|
<div id="tm-main" class=" uk-section uk-padding-remove-top tm-middle">
|
12
|
<div class="uk-grid uk-margin-small-top" >
|
13
|
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
|
14
|
|
15
|
<div class="uk-container uk-container-large">
|
16
|
<div class="uk-article-title custom-article-title">
|
17
|
My links
|
18
|
</div>
|
19
|
|
20
|
<div class=" ">
|
21
|
Manage your links in OpenAIRE
|
22
|
</div>
|
23
|
<div>
|
24
|
<displayClaims *ngIf="user" [user]="user" [enableDelete]=true [myClaims]=true [isAdmin]=false [showUserEmail]=false
|
25
|
[claimsInfoURL]=claimsInfoURL [communityId]=communityId
|
26
|
[piwikSiteId]="piwikSiteId" pageTitle="My links">
|
27
|
</displayClaims>
|
28
|
</div>
|
29
|
</div>
|
30
|
</div>
|
31
|
</div>
|
32
|
</div>
|
33
|
`
|
34
|
|
35
|
})
|
36
|
export class MyClaimsComponent {
|
37
|
@Input() claimsInfoURL: string;
|
38
|
@Input() communityId:string;
|
39
|
@Input() piwikSiteId = null;
|
40
|
@Input() userInfoURL: string;
|
41
|
public user: User = null;
|
42
|
|
43
|
constructor(private userManagementService: UserManagementService, private _router: Router) {}
|
44
|
|
45
|
sub;
|
46
|
ngOnDestroy() {
|
47
|
if (this.sub instanceof Subscriber) {
|
48
|
this.sub.unsubscribe();
|
49
|
}
|
50
|
}
|
51
|
ngOnInit() {
|
52
|
this.sub = this.userManagementService.getUserInfo().subscribe(user => {
|
53
|
this.user = user;
|
54
|
if (!user) {
|
55
|
this._router.navigate(['/user-info'], {
|
56
|
queryParams: {
|
57
|
"errorCode": LoginErrorCodes.NOT_VALID,
|
58
|
"redirectUrl": this._router.url
|
59
|
}
|
60
|
});
|
61
|
}
|
62
|
});
|
63
|
}
|
64
|
|
65
|
}
|