-import { Subscription } from 'rxjs'
+import { forkJoin, Subscription } from 'rxjs'
import { first, tap } from 'rxjs/operators'
import { Component, ComponentFactoryResolver, OnDestroy, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
export class AccountSearchComponent extends AbstractVideoList implements OnInit, OnDestroy {
titlePage: string
loadOnInit = false
+ loadUserVideoPreferences = true
search = ''
filter: VideoFilter = null
this.enableAllFilterIfPossible()
// Parent get the account for us
- this.accountSub = this.accountService.accountLoaded
- .pipe(first())
- .subscribe(account => {
- this.account = account
-
- this.reloadVideos()
- this.generateSyndicationList()
- })
+ this.accountSub = forkJoin([
+ this.accountService.accountLoaded.pipe(first()),
+ this.onUserLoadedSubject.pipe(first())
+ ]).subscribe(([ account ]) => {
+ this.account = account
+
+ this.reloadVideos()
+ })
}
ngOnDestroy () {
}
updateSearch (value: string) {
- if (value === '') this.router.navigate(['../videos'], { relativeTo: this.route })
this.search = value
+ if (!this.search) {
+ this.router.navigate([ '../videos' ], { relativeTo: this.route })
+ return
+ }
+
+ this.videos = []
this.reloadVideos()
}