Created
July 25, 2017 13:38
-
-
Save danielcrisp/80eba6a2677486a0d1779afc911c5a49 to your computer and use it in GitHub Desktop.
TokenInterceptor - Async HTTP Interceptors with Angular 4
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
intercept (request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | |
return this.auth.getUser() | |
.mergeMap((user: User) => { | |
// ... modify the request here ... | |
return next.handle(request); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment