aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/confirm/confirm.service.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-22 15:29:32 +0100
committerChocobozzz <me@florianbigard.com>2018-02-22 15:29:32 +0100
commit1f30a1853e38c20a45722dbd6d38aaaec63839e8 (patch)
treecdce8cc9fcc62d9b3343c9478b1dbcefedcea972 /client/src/app/core/confirm/confirm.service.ts
parent78967fca4cacbc247fa6fb62d64b2d6825a10804 (diff)
downloadPeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.tar.gz
PeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.tar.zst
PeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.zip
Add confirm when admin use custom js/css
Diffstat (limited to 'client/src/app/core/confirm/confirm.service.ts')
-rw-r--r--client/src/app/core/confirm/confirm.service.ts13
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 @@
1import { Injectable } from '@angular/core' 1import { Injectable } from '@angular/core'
2import { Subject } from 'rxjs/Subject' 2import { Subject } from 'rxjs/Subject'
3import 'rxjs/add/operator/first' 3import 'rxjs/add/operator/first'
4import 'rxjs/add/operator/toPromise'
4 5
5@Injectable() 6@Injectable()
6export class ConfirmService { 7export 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}