aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/confirm/confirm.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/core/confirm/confirm.service.ts')
-rw-r--r--client/src/app/core/confirm/confirm.service.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/client/src/app/core/confirm/confirm.service.ts b/client/src/app/core/confirm/confirm.service.ts
index f30feb9d0..d99226f05 100644
--- a/client/src/app/core/confirm/confirm.service.ts
+++ b/client/src/app/core/confirm/confirm.service.ts
@@ -3,19 +3,27 @@ import { Subject } from 'rxjs/Subject'
3import 'rxjs/add/operator/first' 3import 'rxjs/add/operator/first'
4import 'rxjs/add/operator/toPromise' 4import 'rxjs/add/operator/toPromise'
5 5
6type ConfirmOptions = {
7 title: string
8 message: string
9 inputLabel?: string
10 expectedInputValue?: string
11 confirmButtonText?: string
12}
13
6@Injectable() 14@Injectable()
7export class ConfirmService { 15export class ConfirmService {
8 showConfirm = new Subject<{ title: string, message: string, inputLabel?: string, expectedInputValue?: string }>() 16 showConfirm = new Subject<ConfirmOptions>()
9 confirmResponse = new Subject<boolean>() 17 confirmResponse = new Subject<boolean>()
10 18
11 confirm (message: string, title = '') { 19 confirm (message: string, title = '', confirmButtonText?: string) {
12 this.showConfirm.next({ title, message }) 20 this.showConfirm.next({ title, message, confirmButtonText })
13 21
14 return this.confirmResponse.asObservable().first().toPromise() 22 return this.confirmResponse.asObservable().first().toPromise()
15 } 23 }
16 24
17 confirmWithInput (message: string, inputLabel: string, expectedInputValue: string, title = '') { 25 confirmWithInput (message: string, inputLabel: string, expectedInputValue: string, title = '', confirmButtonText?: string) {
18 this.showConfirm.next({ title, message, inputLabel, expectedInputValue }) 26 this.showConfirm.next({ title, message, inputLabel, expectedInputValue, confirmButtonText })
19 27
20 return this.confirmResponse.asObservable().first().toPromise() 28 return this.confirmResponse.asObservable().first().toPromise()
21 } 29 }