Last active
January 20, 2018 21:41
-
-
Save dasmido/7f8e93add0e2ae6453d5bb0dbb82ffbc 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
// function for authenticate user | |
// function to get profile | |
getProfile(){ | |
let headers = new Headers(); | |
this.loadToken(); | |
headers.append('Authorization', this.authToken); | |
headers.append('Content-Type', 'application/json'); | |
return this.http.get('http://localhost:9090/users/profile', {headers: headers}).map(res => res.json()); | |
} | |
// fetch token from local Storage | |
loadToken(){ | |
const token = localStorage.getItem('id_token'); | |
this.authToken = token; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment