import { AccountService } from '@app/shared/account/account.service'
import { tap } from 'rxjs/operators'
import { I18n } from '@ngx-translate/i18n-polyfill'
+import { Subscription } from 'rxjs'
@Component({
selector: 'my-account-videos',
loadOnInit = false
private account: Account
+ private accountSub: Subscription
constructor (
protected router: Router,
super.ngOnInit()
// Parent get the account for us
- this.accountService.accountLoaded
+ this.accountSub = this.accountService.accountLoaded
.subscribe(account => {
this.account = account
- this.currentRoute = '/account/' + this.account.id + '/videos'
+ this.currentRoute = '/account/' + this.account.nameWithHost + '/videos'
- this.loadMoreVideos(this.pagination.currentPage)
+ this.reloadVideos()
this.generateSyndicationList()
})
}
ngOnDestroy () {
+ if (this.accountSub) this.accountSub.unsubscribe()
+
super.ngOnDestroy()
}