Guest User

Untitled

a guest
Sep 10th, 2020
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     private configureOptions(){
  2.         this.currentUser = this.authenticationService.currentUserValue;
  3.         this.httpOptions = {
  4.           headers: new HttpHeaders(),
  5.           responseType: 'blob' as 'json'
  6.         };
  7.         this.httpOptions.headers = this.httpOptions.headers.append('Authorization-User', this.currentUser['id']);
  8.         this.httpOptions.headers = this.httpOptions.headers.append('Authorization-Company', this.currentUser.company['id']);
  9.         this.httpOptions.headers = this.httpOptions.headers.append('Content-Type', 'application/json');
  10.     }
  11.  
  12.     private handleError<T> (operation = 'operation', result?: T) {
  13.         return (error: any): Observable<T> => {
  14.  
  15.         // TODO: send the error to remote logging infrastructure
  16.         console.error(error); // log to console instead
  17.  
  18.         // Let the app keep running by returning an empty result.
  19.         return of(result as T);
  20.         };
  21.     }
  22.  
  23.     //////////////////////////// ///////////////////// ////////////////////
  24.  
  25.     loadReport (filterVM: any): Observable<any> {
  26.  
  27.         ////////// ////////////////////////
  28.  
  29.         return this.http.post<any>(apiUrl + "/Report/Load", filterVM, this.httpOptions).pipe(
  30.           tap((filterVM: any) => console.log(`loading report`)),
  31.           catchError(this.handleError<any>('loadReport'))
  32.         );
  33.     }
Add Comment
Please, Sign In to add comment