import { AuthService, Notifier, RedirectService } from '@app/core'
import { User, UserRight } from '../../../../shared'
import { I18n } from '@ngx-translate/i18n-polyfill'
+import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
+import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
@Component({
templateUrl: './accounts.component.html',
export class AccountsComponent implements OnInit, OnDestroy {
account: Account
user: User
+ videoChannels: VideoChannel[]
private routeSub: Subscription
private route: ActivatedRoute,
private userService: UserService,
private accountService: AccountService,
+ private videoChannelService: VideoChannelService,
private notifier: Notifier,
private restExtractor: RestExtractor,
private redirectService: RedirectService,
map(params => params[ 'accountId' ]),
distinctUntilChanged(),
switchMap(accountId => this.accountService.getAccount(accountId)),
- tap(account => this.getUserIfNeeded(account)),
+ tap(account => {
+ this.account = account
+ this.getUserIfNeeded(account)
+ }),
+ switchMap(account => this.videoChannelService.listAccountVideoChannels(account)),
catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ]))
)
.subscribe(
- account => this.account = account,
+ videoChannels => this.videoChannels = videoChannels.data,
err => this.notifier.error(err.message)
)