]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts
Add mute status in account and channel pages
[github/Chocobozzz/PeerTube.git] / client / src / app / +my-library / my-video-playlists / my-video-playlist-update.component.ts
index 532423ba294a83c4da7ca999b81d28ff47d0a9c4..06ac3ad50aae64dbe777b55dd260d30e11fd0d2d 100644 (file)
@@ -3,7 +3,7 @@ import { map, switchMap } from 'rxjs/operators'
 import { Component, OnDestroy, OnInit } from '@angular/core'
 import { ActivatedRoute, 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,
@@ -51,8 +51,8 @@ export class MyVideoPlaylistUpdateComponent extends MyVideoPlaylistEdit implemen
       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.paramsSub = this.route.params
                          .pipe(
@@ -64,16 +64,18 @@ export class MyVideoPlaylistUpdateComponent extends MyVideoPlaylistEdit implemen
                              ])
                            })
                          )
-                         .subscribe(
-                           ([ videoPlaylistToUpdate, videoPlaylistPrivacies]) => {
+                         .subscribe({
+                           next: ([ videoPlaylistToUpdate, videoPlaylistPrivacies ]) => {
                              this.videoPlaylistToUpdate = videoPlaylistToUpdate
                              this.videoPlaylistPrivacies = videoPlaylistPrivacies
 
                              this.hydrateFormFromPlaylist()
                            },
 
-                           err => this.error = err.message
-                         )
+                           error: err => {
+                             this.error = err.message
+                           }
+                         })
   }
 
   ngOnDestroy () {
@@ -92,14 +94,17 @@ export class MyVideoPlaylistUpdateComponent extends MyVideoPlaylistEdit implemen
       thumbnailfile: body.thumbnailfile || undefined
     }
 
-    this.videoPlaylistService.updateVideoPlaylist(this.videoPlaylistToUpdate, videoPlaylistUpdate).subscribe(
-      () => {
-        this.notifier.success($localize`Playlist ${videoPlaylistUpdate.displayName} updated.`)
-        this.router.navigate([ '/my-library', 'video-playlists' ])
-      },
+    this.videoPlaylistService.updateVideoPlaylist(this.videoPlaylistToUpdate, videoPlaylistUpdate)
+      .subscribe({
+        next: () => {
+          this.notifier.success($localize`Playlist ${videoPlaylistUpdate.displayName} updated.`)
+          this.router.navigate([ '/my-library', 'video-playlists' ])
+        },
 
-      err => this.error = err.message
-    )
+        error: err => {
+          this.error = err.message
+        }
+      })
   }
 
   isCreation () {