diff options
Diffstat (limited to 'client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts')
-rw-r--r-- | client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts | 21 |
1 files changed, 20 insertions, 1 deletions
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 c6cb5ade6..6cd1ff503 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 | |||
@@ -11,6 +11,8 @@ import { FormValidatorService } from '@app/shared/shared-forms' | |||
11 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' | 11 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' |
12 | import { ServerConfig, VideoChannelUpdate } from '@shared/models' | 12 | import { ServerConfig, VideoChannelUpdate } from '@shared/models' |
13 | import { MyVideoChannelEdit } from './my-video-channel-edit' | 13 | import { MyVideoChannelEdit } from './my-video-channel-edit' |
14 | import { HttpErrorResponse } from '@angular/common/http' | ||
15 | import { uploadErrorHandler } from '@app/helpers' | ||
14 | 16 | ||
15 | @Component({ | 17 | @Component({ |
16 | selector: 'my-video-channel-update', | 18 | selector: 'my-video-channel-update', |
@@ -107,10 +109,27 @@ export class MyVideoChannelUpdateComponent extends MyVideoChannelEdit implements | |||
107 | this.videoChannelToUpdate.updateAvatar(data.avatar) | 109 | this.videoChannelToUpdate.updateAvatar(data.avatar) |
108 | }, | 110 | }, |
109 | 111 | ||
110 | err => this.notifier.error(err.message) | 112 | (err: HttpErrorResponse) => uploadErrorHandler({ |
113 | err, | ||
114 | name: $localize`avatar`, | ||
115 | notifier: this.notifier | ||
116 | }) | ||
111 | ) | 117 | ) |
112 | } | 118 | } |
113 | 119 | ||
120 | onAvatarDelete () { | ||
121 | this.videoChannelService.deleteVideoChannelAvatar(this.videoChannelToUpdate.name) | ||
122 | .subscribe( | ||
123 | data => { | ||
124 | this.notifier.success($localize`Avatar deleted.`) | ||
125 | |||
126 | this.videoChannelToUpdate.resetAvatar() | ||
127 | }, | ||
128 | |||
129 | err => this.notifier.error(err.message) | ||
130 | ) | ||
131 | } | ||
132 | |||
114 | get maxAvatarSize () { | 133 | get maxAvatarSize () { |
115 | return this.serverConfig.avatar.file.size.max | 134 | return this.serverConfig.avatar.file.size.max |
116 | } | 135 | } |