aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+my-account/my-account.component.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/client/src/app/+my-account/my-account.component.ts b/client/src/app/+my-account/my-account.component.ts
index 7100638c8..fed6e6b04 100644
--- a/client/src/app/+my-account/my-account.component.ts
+++ b/client/src/app/+my-account/my-account.component.ts
@@ -1,18 +1,21 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ServerService } from '@app/core' 2import { ServerService } from '@app/core'
3import { NavigationStart, Router } from '@angular/router' 3import { NavigationStart, Router } from '@angular/router'
4import { filter } from 'rxjs/operators' 4import { filter } from 'rxjs/operators'
5import { I18n } from '@ngx-translate/i18n-polyfill' 5import { I18n } from '@ngx-translate/i18n-polyfill'
6import { Subscription } from 'rxjs'
6 7
7@Component({ 8@Component({
8 selector: 'my-my-account', 9 selector: 'my-my-account',
9 templateUrl: './my-account.component.html', 10 templateUrl: './my-account.component.html',
10 styleUrls: [ './my-account.component.scss' ] 11 styleUrls: [ './my-account.component.scss' ]
11}) 12})
12export class MyAccountComponent implements OnInit { 13export class MyAccountComponent implements OnInit, OnDestroy {
13 14
14 libraryLabel = '' 15 libraryLabel = ''
15 16
17 private routeSub: Subscription
18
16 constructor ( 19 constructor (
17 private serverService: ServerService, 20 private serverService: ServerService,
18 private router: Router, 21 private router: Router,
@@ -22,11 +25,15 @@ export class MyAccountComponent implements OnInit {
22 ngOnInit () { 25 ngOnInit () {
23 this.updateLibraryLabel(this.router.url) 26 this.updateLibraryLabel(this.router.url)
24 27
25 this.router.events 28 this.routeSub = this.router.events
26 .pipe(filter(event => event instanceof NavigationStart)) 29 .pipe(filter(event => event instanceof NavigationStart))
27 .subscribe((event: NavigationStart) => this.updateLibraryLabel(event.url)) 30 .subscribe((event: NavigationStart) => this.updateLibraryLabel(event.url))
28 } 31 }
29 32
33 ngOnDestroy () {
34 if (this.routeSub) this.routeSub.unsubscribe()
35 }
36
30 isVideoImportEnabled () { 37 isVideoImportEnabled () {
31 const importConfig = this.serverService.getConfig().import.videos 38 const importConfig = this.serverService.getConfig().import.videos
32 39