]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/core/confirm/confirm.service.ts
Bumped to version v0.0.29-alpha
[github/Chocobozzz/PeerTube.git] / client / src / app / core / confirm / confirm.service.ts
... / ...
CommitLineData
1import { Injectable } from '@angular/core'
2import { Subject } from 'rxjs/Subject'
3import 'rxjs/add/operator/first'
4import 'rxjs/add/operator/toPromise'
5
6@Injectable()
7export class ConfirmService {
8 showConfirm = new Subject<{ title: string, message: string, inputLabel?: string, expectedInputValue?: string }>()
9 confirmResponse = new Subject<boolean>()
10
11 confirm (message: string, title = '') {
12 this.showConfirm.next({ title, message })
13
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()
21 }
22}