diff options
Diffstat (limited to 'client/src/app/videos/video-list/video-miniature.component.ts')
-rw-r--r-- | client/src/app/videos/video-list/video-miniature.component.ts | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/client/src/app/videos/video-list/video-miniature.component.ts b/client/src/app/videos/video-list/video-miniature.component.ts index ca4afc451..ba4715597 100644 --- a/client/src/app/videos/video-list/video-miniature.component.ts +++ b/client/src/app/videos/video-list/video-miniature.component.ts | |||
@@ -2,6 +2,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core'; | |||
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications'; | 3 | import { NotificationsService } from 'angular2-notifications'; |
4 | 4 | ||
5 | import { ConfirmService } from '../../core'; | ||
5 | import { SortField, Video, VideoService } from '../shared'; | 6 | import { SortField, Video, VideoService } from '../shared'; |
6 | import { User } from '../../shared'; | 7 | import { User } from '../../shared'; |
7 | 8 | ||
@@ -22,6 +23,7 @@ export class VideoMiniatureComponent { | |||
22 | 23 | ||
23 | constructor( | 24 | constructor( |
24 | private notificationsService: NotificationsService, | 25 | private notificationsService: NotificationsService, |
26 | private confirmService: ConfirmService, | ||
25 | private videoService: VideoService | 27 | private videoService: VideoService |
26 | ) {} | 28 | ) {} |
27 | 29 | ||
@@ -38,12 +40,16 @@ export class VideoMiniatureComponent { | |||
38 | } | 40 | } |
39 | 41 | ||
40 | removeVideo(id: string) { | 42 | removeVideo(id: string) { |
41 | if (confirm('Do you really want to remove this video?')) { | 43 | this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe( |
42 | this.videoService.removeVideo(id).subscribe( | 44 | res => { |
43 | status => this.removed.emit(true), | 45 | if (res === false) return; |
44 | 46 | ||
45 | error => this.notificationsService.error('Error', error.text) | 47 | this.videoService.removeVideo(id).subscribe( |
46 | ); | 48 | status => this.removed.emit(true), |
47 | } | 49 | |
50 | error => this.notificationsService.error('Error', error.text) | ||
51 | ); | ||
52 | } | ||
53 | ); | ||
48 | } | 54 | } |
49 | } | 55 | } |