From 1f30a1853e38c20a45722dbd6d38aaaec63839e8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 22 Feb 2018 15:29:32 +0100 Subject: Add confirm when admin use custom js/css --- client/src/app/core/confirm/confirm.service.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'client/src/app/core/confirm/confirm.service.ts') diff --git a/client/src/app/core/confirm/confirm.service.ts b/client/src/app/core/confirm/confirm.service.ts index f12ff1848..f30feb9d0 100644 --- a/client/src/app/core/confirm/confirm.service.ts +++ b/client/src/app/core/confirm/confirm.service.ts @@ -1,15 +1,22 @@ import { Injectable } from '@angular/core' import { Subject } from 'rxjs/Subject' import 'rxjs/add/operator/first' +import 'rxjs/add/operator/toPromise' @Injectable() export class ConfirmService { - showConfirm = new Subject<{ title, message }>() + showConfirm = new Subject<{ title: string, message: string, inputLabel?: string, expectedInputValue?: string }>() confirmResponse = new Subject() - confirm (message = '', title = '') { + confirm (message: string, title = '') { this.showConfirm.next({ title, message }) - return this.confirmResponse.asObservable().first() + return this.confirmResponse.asObservable().first().toPromise() + } + + confirmWithInput (message: string, inputLabel: string, expectedInputValue: string, title = '') { + this.showConfirm.next({ title, message, inputLabel, expectedInputValue }) + + return this.confirmResponse.asObservable().first().toPromise() } } -- cgit v1.2.3