aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts51
1 files changed, 22 insertions, 29 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index 6b118b1de..d04d50310 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -130,24 +130,21 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
130 } 130 }
131 } 131 }
132 132
133 blacklistVideo (event: Event) { 133 async blacklistVideo (event: Event) {
134 event.preventDefault() 134 event.preventDefault()
135 135
136 this.confirmService.confirm('Do you really want to blacklist this video?', 'Blacklist').subscribe( 136 const res = await this.confirmService.confirm('Do you really want to blacklist this video?', 'Blacklist')
137 res => { 137 if (res === false) return
138 if (res === false) return
139 138
140 this.videoBlacklistService.blacklistVideo(this.video.id) 139 this.videoBlacklistService.blacklistVideo(this.video.id)
141 .subscribe( 140 .subscribe(
142 status => { 141 status => {
143 this.notificationsService.success('Success', `Video ${this.video.name} had been blacklisted.`) 142 this.notificationsService.success('Success', `Video ${this.video.name} had been blacklisted.`)
144 this.router.navigate(['/videos/list']) 143 this.router.navigate(['/videos/list'])
145 }, 144 },
146 145
147 error => this.notificationsService.error('Error', error.message) 146 error => this.notificationsService.error('Error', error.message)
148 ) 147 )
149 }
150 )
151 } 148 }
152 149
153 showMoreDescription () { 150 showMoreDescription () {
@@ -236,26 +233,22 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
236 return this.video.isRemovableBy(this.authService.getUser()) 233 return this.video.isRemovableBy(this.authService.getUser())
237 } 234 }
238 235
239 removeVideo (event: Event) { 236 async removeVideo (event: Event) {
240 event.preventDefault() 237 event.preventDefault()
241 238
242 this.confirmService.confirm('Do you really want to delete this video?', 'Delete') 239 const res = await this.confirmService.confirm('Do you really want to delete this video?', 'Delete')
243 .subscribe( 240 if (res === false) return
244 res => {
245 if (res === false) return
246 241
247 this.videoService.removeVideo(this.video.id) 242 this.videoService.removeVideo(this.video.id)
248 .subscribe( 243 .subscribe(
249 status => { 244 status => {
250 this.notificationsService.success('Success', `Video ${this.video.name} deleted.`) 245 this.notificationsService.success('Success', `Video ${this.video.name} deleted.`)
251 246
252 // Go back to the video-list. 247 // Go back to the video-list.
253 this.router.navigate([ '/videos/list' ]) 248 this.router.navigate([ '/videos/list' ])
254 }, 249 },
255 250
256 error => this.notificationsService.error('Error', error.message) 251 error => this.notificationsService.error('Error', error.message)
257 )
258 }
259 ) 252 )
260 } 253 }
261 254