|
@ -3,7 +3,11 @@ import { Access } from '@ghostfolio/api/app/access/interfaces/access.interface'; |
|
|
import { User } from '@ghostfolio/api/app/user/interfaces/user.interface'; |
|
|
import { User } from '@ghostfolio/api/app/user/interfaces/user.interface'; |
|
|
import { DataService } from '@ghostfolio/client/services/data.service'; |
|
|
import { DataService } from '@ghostfolio/client/services/data.service'; |
|
|
import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service'; |
|
|
import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service'; |
|
|
import { DEFAULT_DATE_FORMAT } from '@ghostfolio/helper'; |
|
|
import { |
|
|
|
|
|
DEFAULT_DATE_FORMAT, |
|
|
|
|
|
hasPermission, |
|
|
|
|
|
permissions |
|
|
|
|
|
} from '@ghostfolio/helper'; |
|
|
import { Subject } from 'rxjs'; |
|
|
import { Subject } from 'rxjs'; |
|
|
import { takeUntil } from 'rxjs/operators'; |
|
|
import { takeUntil } from 'rxjs/operators'; |
|
|
|
|
|
|
|
@ -19,6 +23,7 @@ export class AccountPageComponent implements OnDestroy, OnInit { |
|
|
public baseCurrency: Currency; |
|
|
public baseCurrency: Currency; |
|
|
public currencies: Currency[] = []; |
|
|
public currencies: Currency[] = []; |
|
|
public defaultDateFormat = DEFAULT_DATE_FORMAT; |
|
|
public defaultDateFormat = DEFAULT_DATE_FORMAT; |
|
|
|
|
|
public hasPermissionForSubscription: boolean; |
|
|
public user: User; |
|
|
public user: User; |
|
|
|
|
|
|
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
private unsubscribeSubject = new Subject<void>(); |
|
@ -34,8 +39,13 @@ export class AccountPageComponent implements OnDestroy, OnInit { |
|
|
this.dataService |
|
|
this.dataService |
|
|
.fetchInfo() |
|
|
.fetchInfo() |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.subscribe(({ currencies }) => { |
|
|
.subscribe(({ currencies, globalPermissions }) => { |
|
|
this.currencies = currencies; |
|
|
this.currencies = currencies; |
|
|
|
|
|
|
|
|
|
|
|
this.hasPermissionForSubscription = hasPermission( |
|
|
|
|
|
globalPermissions, |
|
|
|
|
|
permissions.enableSubscription |
|
|
|
|
|
); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
this.tokenStorageService |
|
|
this.tokenStorageService |
|
@ -70,6 +80,11 @@ export class AccountPageComponent implements OnDestroy, OnInit { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
|
|
|
this.unsubscribeSubject.next(); |
|
|
|
|
|
this.unsubscribeSubject.complete(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private update() { |
|
|
private update() { |
|
|
this.dataService |
|
|
this.dataService |
|
|
.fetchAccesses() |
|
|
.fetchAccesses() |
|
@ -80,9 +95,4 @@ export class AccountPageComponent implements OnDestroy, OnInit { |
|
|
this.cd.markForCheck(); |
|
|
this.cd.markForCheck(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
|
|
|
this.unsubscribeSubject.next(); |
|
|
|
|
|
this.unsubscribeSubject.complete(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|