mirror of https://github.com/abpframework/abp.git
2 changed files with 30 additions and 0 deletions
@ -0,0 +1,29 @@ |
|||
import { HttpErrorResponse } from '@angular/common/http'; |
|||
import { Injectable } from '@angular/core'; |
|||
import { BehaviorSubject, of, Subject } from 'rxjs'; |
|||
|
|||
@Injectable({ providedIn: 'root' }) |
|||
export class HttpErrorReporterService { |
|||
private _reporter$ = new Subject(); |
|||
private _errors$ = new BehaviorSubject<HttpErrorResponse[]>([]); |
|||
|
|||
get reporter$() { |
|||
return this._reporter$.asObservable(); |
|||
} |
|||
|
|||
get erros$() { |
|||
return this._errors$.asObservable(); |
|||
} |
|||
|
|||
get errors() { |
|||
return this._errors$.value; |
|||
} |
|||
|
|||
reportError = (error: HttpErrorResponse) => { |
|||
this._reporter$.next(error); |
|||
this._errors$.next([...this.errors, error]); |
|||
return of(); |
|||
}; |
|||
|
|||
constructor() {} |
|||
} |
|||
Loading…
Reference in new issue