diff options
Diffstat (limited to 'client/src/app/core/confirm/confirm.service.ts')
-rw-r--r-- | client/src/app/core/confirm/confirm.service.ts | 13 |
1 files changed, 10 insertions, 3 deletions
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 @@ | |||
1 | import { Injectable } from '@angular/core' | 1 | import { Injectable } from '@angular/core' |
2 | import { Subject } from 'rxjs/Subject' | 2 | import { Subject } from 'rxjs/Subject' |
3 | import 'rxjs/add/operator/first' | 3 | import 'rxjs/add/operator/first' |
4 | import 'rxjs/add/operator/toPromise' | ||
4 | 5 | ||
5 | @Injectable() | 6 | @Injectable() |
6 | export class ConfirmService { | 7 | export class ConfirmService { |
7 | showConfirm = new Subject<{ title, message }>() | 8 | showConfirm = new Subject<{ title: string, message: string, inputLabel?: string, expectedInputValue?: string }>() |
8 | confirmResponse = new Subject<boolean>() | 9 | confirmResponse = new Subject<boolean>() |
9 | 10 | ||
10 | confirm (message = '', title = '') { | 11 | confirm (message: string, title = '') { |
11 | this.showConfirm.next({ title, message }) | 12 | this.showConfirm.next({ title, message }) |
12 | 13 | ||
13 | return this.confirmResponse.asObservable().first() | 14 | return this.confirmResponse.asObservable().first().toPromise() |
15 | } | ||
16 | |||
17 | confirmWithInput (message: string, inputLabel: string, expectedInputValue: string, title = '') { | ||
18 | this.showConfirm.next({ title, message, inputLabel, expectedInputValue }) | ||
19 | |||
20 | return this.confirmResponse.asObservable().first().toPromise() | ||
14 | } | 21 | } |
15 | } | 22 | } |