Skip to content

Instantly share code, notes, and snippets.

@danielcrisp
Created July 25, 2017 13:38
Show Gist options
  • Save danielcrisp/80eba6a2677486a0d1779afc911c5a49 to your computer and use it in GitHub Desktop.
Save danielcrisp/80eba6a2677486a0d1779afc911c5a49 to your computer and use it in GitHub Desktop.
TokenInterceptor - Async HTTP Interceptors with Angular 4
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