aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/confirm/confirm.service.ts
blob: b9796979591754d23999796d76748ed7084f7fc8 (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: string = '', title: string = '') {
    this.showConfirm.next({ title, message });

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