import { Component, OnInit } from '@angular/core'
import { Router } from '@angular/router'
import { AuthService, Notifier, ServerService } from '@app/core'
-import { populateAsyncUserVideoChannels } from '@app/helpers'
+import { listUserChannels } from '@app/helpers'
import {
setPlaylistChannelValidator,
VIDEO_PLAYLIST_CHANNEL_ID_VALIDATOR,
private router: Router,
private videoPlaylistService: VideoPlaylistService,
private serverService: ServerService
- ) {
+ ) {
super()
}
setPlaylistChannelValidator(this.form.get('videoChannelId'), privacy)
})
- populateAsyncUserVideoChannels(this.authService, this.userVideoChannels)
- .catch(err => console.error('Cannot populate user video channels.', err))
+ listUserChannels(this.authService)
+ .subscribe(channels => this.userVideoChannels = channels)
this.serverService.getVideoPlaylistPrivacies()
.subscribe(videoPlaylistPrivacies => {
thumbnailfile: body.thumbnailfile || null
}
- this.videoPlaylistService.createVideoPlaylist(videoPlaylistCreate).subscribe(
- () => {
- this.notifier.success($localize`Playlist ${videoPlaylistCreate.displayName} created.`)
- this.router.navigate([ '/my-library', 'video-playlists' ])
- },
+ this.videoPlaylistService.createVideoPlaylist(videoPlaylistCreate)
+ .subscribe({
+ next: () => {
+ this.notifier.success($localize`Playlist ${videoPlaylistCreate.displayName} created.`)
+ this.router.navigate([ '/my-library', 'video-playlists' ])
+ },
- err => this.error = err.message
- )
+ error: err => {
+ this.error = err.message
+ }
+ })
}
isCreation () {