Created
June 28, 2019 15:51
-
-
Save nanotroy/1f01024432f3d113b50aa290443e86bc 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
token = this.auth.getToken() // auth is provided via constructor. | |
if (token) { | |
// Logged in. Add Bearer token. | |
return next.handle( | |
req.clone({ | |
headers: req.headers.append('Authorization', 'Bearer ' + token) | |
}) | |
); | |
} | |
// Not logged in. Continue without modification. | |
return next.handle(req); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment