From 5769e1db8d3d5a1e3baa8dff23090cfe93d48a50 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 27 Jan 2017 16:54:44 +0100 Subject: Client: better confirm box for a beautiful world --- .../app/videos/video-list/video-miniature.component.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'client/src/app/videos/video-list/video-miniature.component.ts') 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'; import { NotificationsService } from 'angular2-notifications'; +import { ConfirmService } from '../../core'; import { SortField, Video, VideoService } from '../shared'; import { User } from '../../shared'; @@ -22,6 +23,7 @@ export class VideoMiniatureComponent { constructor( private notificationsService: NotificationsService, + private confirmService: ConfirmService, private videoService: VideoService ) {} @@ -38,12 +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), + this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe( + res => { + if (res === false) return; - error => this.notificationsService.error('Error', error.text) - ); - } + this.videoService.removeVideo(id).subscribe( + status => this.removed.emit(true), + + error => this.notificationsService.error('Error', error.text) + ); + } + ); } } -- cgit v1.2.3