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.ts11
1 files changed, 3 insertions, 8 deletions
diff --git a/client/src/app/core/confirm/confirm.service.ts b/client/src/app/core/confirm/confirm.service.ts
index 6e042c16b..338b8762c 100644
--- a/client/src/app/core/confirm/confirm.service.ts
+++ b/client/src/app/core/confirm/confirm.service.ts
@@ -1,6 +1,5 @@
1import { first } from 'rxjs/operators' 1import { firstValueFrom, Subject } from 'rxjs'
2import { Injectable } from '@angular/core' 2import { Injectable } from '@angular/core'
3import { Subject } from 'rxjs'
4 3
5type ConfirmOptions = { 4type ConfirmOptions = {
6 title: string 5 title: string
@@ -18,16 +17,12 @@ export class ConfirmService {
18 confirm (message: string, title = '', confirmButtonText?: string) { 17 confirm (message: string, title = '', confirmButtonText?: string) {
19 this.showConfirm.next({ title, message, confirmButtonText }) 18 this.showConfirm.next({ title, message, confirmButtonText })
20 19
21 return this.confirmResponse.asObservable() 20 return firstValueFrom(this.confirmResponse.asObservable())
22 .pipe(first())
23 .toPromise()
24 } 21 }
25 22
26 confirmWithInput (message: string, inputLabel: string, expectedInputValue: string, title = '', confirmButtonText?: string) { 23 confirmWithInput (message: string, inputLabel: string, expectedInputValue: string, title = '', confirmButtonText?: string) {
27 this.showConfirm.next({ title, message, inputLabel, expectedInputValue, confirmButtonText }) 24 this.showConfirm.next({ title, message, inputLabel, expectedInputValue, confirmButtonText })
28 25
29 return this.confirmResponse.asObservable() 26 return firstValueFrom(this.confirmResponse.asObservable())
30 .pipe(first())
31 .toPromise()
32 } 27 }
33} 28}