aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/confirm/confirm.service.ts
blob: 08127a66ff223f146f6530be2a9eab34b71c25a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import 'rxjs/add/operator/first';

@Injectable()
export class ConfirmService {
  showConfirm = new Subject<{ title, message }>();
  confirmResponse = new Subject<boolean>();

  confirm(message = '', title = '') {
    this.showConfirm.next({ title, message });

    return this.confirmResponse.asObservable().first();
  }
}