From 1378c0d343028f3d40d7d795422684ab9e6a1599 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 Aug 2021 11:27:47 +0200 Subject: Fix client lint --- .../my-video-channel-create.component.ts | 8 +-- .../my-video-channel-update.component.ts | 78 +++++++++++----------- .../my-video-channels.component.ts | 8 +-- 3 files changed, 48 insertions(+), 46 deletions(-) (limited to 'client/src/app/+my-library/+my-video-channels') diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts b/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts index 433475f66..d983aacd9 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts +++ b/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts @@ -59,15 +59,15 @@ export class MyVideoChannelCreateComponent extends MyVideoChannelEdit implements .pipe( switchMap(() => this.uploadAvatar()), switchMap(() => this.uploadBanner()) - ).subscribe( - () => { + ).subscribe({ + next: () => { this.authService.refreshUserInformation() this.notifier.success($localize`Video channel ${videoChannelCreate.displayName} created.`) this.router.navigate(['/my-library', 'video-channels']) }, - err => { + error: err => { if (err.status === HttpStatusCode.CONFLICT_409) { this.error = $localize`This name already exists on this instance.` return @@ -75,7 +75,7 @@ export class MyVideoChannelCreateComponent extends MyVideoChannelEdit implements this.error = err.message } - ) + }) } onAvatarChange (formData: FormData) { diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts b/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts index eb24a60c5..e8bfbf9ce 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts +++ b/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts @@ -52,21 +52,22 @@ export class MyVideoChannelUpdateComponent extends MyVideoChannelEdit implements this.paramsSub = this.route.params.subscribe(routeParams => { const videoChannelId = routeParams['videoChannelId'] - this.videoChannelService.getVideoChannel(videoChannelId).subscribe( - videoChannelToUpdate => { - this.videoChannel = videoChannelToUpdate - - this.oldSupportField = videoChannelToUpdate.support - - this.form.patchValue({ - 'display-name': videoChannelToUpdate.displayName, - description: videoChannelToUpdate.description, - support: videoChannelToUpdate.support - }) - }, + this.videoChannelService.getVideoChannel(videoChannelId) + .subscribe({ + next: videoChannelToUpdate => { + this.videoChannel = videoChannelToUpdate + + this.oldSupportField = videoChannelToUpdate.support + + this.form.patchValue({ + 'display-name': videoChannelToUpdate.displayName, + description: videoChannelToUpdate.description, + support: videoChannelToUpdate.support + }) + }, - err => this.error = err.message - ) + error: err => this.error = err.message + }) }) } @@ -85,77 +86,78 @@ export class MyVideoChannelUpdateComponent extends MyVideoChannelEdit implements bulkVideosSupportUpdate: body.bulkVideosSupportUpdate || false } - this.videoChannelService.updateVideoChannel(this.videoChannel.name, videoChannelUpdate).subscribe( - () => { - this.authService.refreshUserInformation() + this.videoChannelService.updateVideoChannel(this.videoChannel.name, videoChannelUpdate) + .subscribe({ + next: () => { + this.authService.refreshUserInformation() - this.notifier.success($localize`Video channel ${videoChannelUpdate.displayName} updated.`) + this.notifier.success($localize`Video channel ${videoChannelUpdate.displayName} updated.`) - this.router.navigate([ '/my-library', 'video-channels' ]) - }, + this.router.navigate([ '/my-library', 'video-channels' ]) + }, - err => this.error = err.message - ) + error: err => this.error = err.message + }) } onAvatarChange (formData: FormData) { this.videoChannelService.changeVideoChannelImage(this.videoChannel.name, formData, 'avatar') - .subscribe( - data => { + .subscribe({ + next: data => { this.notifier.success($localize`Avatar changed.`) this.videoChannel.updateAvatar(data.avatar) }, - (err: HttpErrorResponse) => genericUploadErrorHandler({ + error: (err: HttpErrorResponse) => genericUploadErrorHandler({ err, name: $localize`avatar`, notifier: this.notifier }) - ) + }) } onAvatarDelete () { this.videoChannelService.deleteVideoChannelImage(this.videoChannel.name, 'avatar') - .subscribe( - data => { + .subscribe({ + next: () => { this.notifier.success($localize`Avatar deleted.`) this.videoChannel.resetAvatar() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } onBannerChange (formData: FormData) { this.videoChannelService.changeVideoChannelImage(this.videoChannel.name, formData, 'banner') - .subscribe( - data => { + .subscribe({ + next: data => { this.notifier.success($localize`Banner changed.`) this.videoChannel.updateBanner(data.banner) }, - (err: HttpErrorResponse) => genericUploadErrorHandler({ + error: (err: HttpErrorResponse) => genericUploadErrorHandler({ err, name: $localize`banner`, notifier: this.notifier }) - ) + }) } onBannerDelete () { this.videoChannelService.deleteVideoChannelImage(this.videoChannel.name, 'banner') - .subscribe( - data => { + .subscribe({ + next: () => { this.notifier.success($localize`Banner deleted.`) this.videoChannel.resetBanner() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } get maxAvatarSize () { diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts index b6a2f592d..8b665fd58 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts +++ b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts @@ -54,14 +54,14 @@ channel with the same name (${videoChannel.name})!`, if (res === false) return this.videoChannelService.removeVideoChannel(videoChannel) - .subscribe( - () => { + .subscribe({ + next: () => { this.loadVideoChannels() this.notifier.success($localize`Video channel ${videoChannel.displayName} deleted.`) }, - error => this.notifier.error(error.message) - ) + error: err => this.notifier.error(err.message) + }) } private loadVideoChannels () { -- cgit v1.2.3