projects/app-base-library/src/lib/angular/services/form.service.ts
Properties |
|
Methods |
|
constructor()
|
errorHandler | ||||||
errorHandler(error: any)
|
||||||
Parameters :
Returns :
void
|
Public init | ||||
init(options: )
|
||||
Parameters :
Returns :
void
|
Public model |
model:
|
Type : any
|
import { Injectable, EventEmitter } from '@angular/core';
// import { Observable } from 'rxjs/Rx';
@Injectable()
export class FormService {
public model: any;
constructor() { }
public init(options) {
};
// todo: errorHandler
errorHandler(error: any) {
console.log(error);
// AppService.scope.$broadcast('formError', error);
// if(AppSettings.dev){
// console.log(error);
// }
// if(!error){
// return;
// }
// if(error.data === "token expired"){
// toastr.warning($filter('translate')('LOGIN EXPIRED')+'.');
// service.logOut();
// return;
// }
// if (error.statusText === 'Bad Request' || error.status == 400) {
// if (error.data.message) {
// toastr.warning($filter('translate')(error.data.message));
// } else {
// toastr.warning($filter('translate')('ERROR BAD REQUEST') + '.');
// }
// }
// if(error.statusText === 'Unauthorized' || error.status == 401){
// toastr.warning($filter('translate')('UNAUTHORIZED ERROR')+'.');
// service.logOut();
// return;
// }
// if(error.statusText === 'Not found' || error.status == 404){
// toastr.warning($filter('translate')('ERROR NOT FOUND')+'.');
// }
}
}