Revision 59816
Added by Argiro Kokogiannaki over 3 years ago
claimsAdmin.component.ts | ||
---|---|---|
1 | 1 |
import {Component, Input} from '@angular/core'; |
2 | 2 |
import {Title, Meta} from '@angular/platform-browser'; |
3 |
import {Session, User} from "../../login/utils/helper.class";
|
|
3 |
import {User} from "../../login/utils/helper.class"; |
|
4 | 4 |
import {UserManagementService} from "../../services/user-management.service"; |
5 | 5 |
import {LoginErrorCodes} from "../../login/utils/guardHelper.class"; |
6 | 6 |
import {Router} from "@angular/router"; |
7 |
import {Subscriber} from "rxjs"; |
|
7 | 8 |
|
8 | 9 |
|
9 | 10 |
@Component({ |
... | ... | |
45 | 46 |
@Input() claimsInfoURL: string; |
46 | 47 |
@Input() userInfoURL: string; |
47 | 48 |
public user: User = null; |
48 |
|
|
49 |
sub; |
|
49 | 50 |
constructor(private _meta: Meta, private _title: Title, |
50 | 51 |
private userManagementService: UserManagementService, private _router: Router) { |
51 | 52 |
var titleConnect = "OpenAIRE Connect | Manage links "; |
... | ... | |
59 | 60 |
|
60 | 61 |
|
61 | 62 |
} |
62 |
|
|
63 |
ngOnDestroy() { |
|
64 |
if (this.sub instanceof Subscriber) { |
|
65 |
this.sub.unsubscribe(); |
|
66 |
} |
|
67 |
} |
|
63 | 68 |
ngOnInit() { |
64 |
this.userManagementService.getUserInfo().subscribe(user => { |
|
69 |
this.sub = this.userManagementService.getUserInfo().subscribe(user => {
|
|
65 | 70 |
this.user = user; |
66 | 71 |
if (!user) { |
67 | 72 |
this._router.navigate(['/user-info'], { |
Also available in: Unified diff
[Library|Trunk]
code clean up:
-remove app.* files from library
-remove unused imports, code, files (Old search pages for results, dataproviders, map search page, etc)
-remove Freeguard from modules
-unsubscribe all subscriptions
-Services: configuration, isvocabularies, user management: unsubscribe from app component or the component that uses them (clearSubscriptions())
-Fetchers: unsubscribe from the component that uses them (clearSubscriptions())