Last active
August 18, 2021 02:52
-
-
Save fasfsfgs/850575a7bfb1ffac40f241301d708c77 to your computer and use it in GitHub Desktop.
angular interceptor
This file contains hidden or 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
export const BYPASS_LOG = new HttpContextToken(() => false); | |
export class MyLogInterceptor implements HttpInterceptor { | |
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | |
if (req.context.get(BYPASS_LOG) === true) | |
return next.handle(req); | |
console.log(`req to ${req.url}`); | |
return next.handle(req); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment