X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2Fvideo-list%2Fvideo-miniature.component.ts;h=ba47155972a08d2b24cce7290b488b9da3a2342d;hb=e2a2d6c86c7ca39074fdff3b545947d1d58dc008;hp=398d2db7507a2d4f4f2f6df78e9e99ca5b0488e8;hpb=da4971c11f16b541804b5071d543166cd3954a98;p=github%2FChocobozzz%2FPeerTube.git 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 398d2db75..ba4715597 100644 --- a/client/src/app/videos/video-list/video-miniature.component.ts +++ b/client/src/app/videos/video-list/video-miniature.component.ts @@ -1,5 +1,8 @@ import { Component, Input, Output, EventEmitter } from '@angular/core'; +import { NotificationsService } from 'angular2-notifications'; + +import { ConfirmService } from '../../core'; import { SortField, Video, VideoService } from '../shared'; import { User } from '../../shared'; @@ -18,7 +21,11 @@ export class VideoMiniatureComponent { hovering = false; - constructor(private videoService: VideoService) {} + constructor( + private notificationsService: NotificationsService, + private confirmService: ConfirmService, + private videoService: VideoService + ) {} displayRemoveIcon() { return this.hovering && this.video.isRemovableBy(this.user); @@ -33,11 +40,16 @@ export class VideoMiniatureComponent { } removeVideo(id: string) { - if (confirm('Do you really want to remove this video?')) { - this.videoService.removeVideo(id).subscribe( - status => this.removed.emit(true), - error => alert(error.text) - ); - } + this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe( + res => { + if (res === false) return; + + this.videoService.removeVideo(id).subscribe( + status => this.removed.emit(true), + + error => this.notificationsService.error('Error', error.text) + ); + } + ); } }