aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/error/error.component.service.ts
blob: 35b83f0b6dde402584518118f91ad2da8f1f72aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import {Injectable} from "@angular/core";
import {Subject} from "rxjs/Subject";
import { MessageBoxService } from '../messageBox/messageBox.service';
import { MessageBoxData, ModalSize, ModalType } from '../messageBox/messageBox.data';

@Injectable()
export class ErrorService {
  static showErrorWithMessage(error : ErrorMessage) : void {
    setTimeout(()=>{
        let messageBoxData : MessageBoxData = new MessageBoxData(
          error.title,  // modal title
          error.text,

          ModalType.error,
          ModalSize.medium,
          [
            {text:"Close", size:"large", closeModal:true}
          ]);
        MessageBoxService.openModal.next(messageBoxData);
      }
      ,500);
  }
}

export class ErrorMessage {
  title : string;
  text : string;
  errorNumber : number;

  constructor( title : string, text : string,errorNumber : number){
    this.title = title;
    this.text = text;
    this.errorNumber = errorNumber;
  }
}