+import { firstValueFrom, Subject } from 'rxjs'
import { Injectable } from '@angular/core'
-import { Subject } from 'rxjs/Subject'
-import 'rxjs/add/operator/first'
-import 'rxjs/add/operator/toPromise'
type ConfirmOptions = {
title: string
confirm (message: string, title = '', confirmButtonText?: string) {
this.showConfirm.next({ title, message, confirmButtonText })
- return this.confirmResponse.asObservable().first().toPromise()
+ return firstValueFrom(this.confirmResponse.asObservable())
}
confirmWithInput (message: string, inputLabel: string, expectedInputValue: string, title = '', confirmButtonText?: string) {
this.showConfirm.next({ title, message, inputLabel, expectedInputValue, confirmButtonText })
- return this.confirmResponse.asObservable().first().toPromise()
+ return firstValueFrom(this.confirmResponse.asObservable())
}
}