Last active
May 25, 2018 03:40
-
-
Save ricmello/06180cc05499b5acff99a4ed90de5ea2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { InjectionToken } from '@angular/core'; | |
import { HttpClient, HttpEvent, HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
declare module '@angular/common/http/src/client' { | |
export interface HttpClient { | |
hideLoader(hide?: boolean): HttpClient; | |
} | |
} | |
class HttpInterceptorHandler implements HttpHandler { | |
constructor(private next: HttpHandler, private interceptor: HttpInterceptor) { } | |
handle(request: HttpRequest<any>): Observable<HttpEvent<any>> { | |
return this.interceptor.intercept(request, this.next); | |
} | |
} | |
export const HTTP_DYNAMIC_INTERCEPTORS = new InjectionToken<HttpInterceptor>('HTTP_DYNAMIC_INTERCEPTORS'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment