Guest User

Untitled

a guest
Feb 25th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. // get token data from storage
  2. this.storage.get('auth').then((val) => {
  3. this.headers = new Headers();
  4. this.headers.append('Content-Type','application/x-www-form-urlencoded');
  5. this.headers.append('Authorization', val);
  6. console.log(this.headers.get('Authorization')) //displays: Token randomKey1244556etc
  7.  
  8.  
  9. //request
  10. this.http.get<any>("http://192.168.22.5/api-get-user", {headers: this.headers})
  11. .subscribe(data => {
  12. console.log(data);
  13. }, (err) => {
  14. console.log(err);
  15. });
  16. }, (err) => {
  17. this.flag = false;
  18. })
Add Comment
Please, Sign In to add comment