Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. function getUserData() {
  2.  
  3. var xhttp = new XMLHttpRequest();
  4. xhttp.onreadystatechange = function () {
  5. if (this.readyState == 4 && this.status == 200) {
  6. accountDetails = JSON.parse(this.responseText);
  7. loadSubscriptions();
  8. (<any>document.getElementById("avatarimg")).setAttribute("src","./avatar/"+ accountDetails.avatarId +".svg");
  9. console.log(accountDetails);
  10. }
  11.  
  12. };
  13.  
  14. fetch('http://localhost:8080/api/users/current')
  15. .then(function (response) {
  16. return response.json();
  17. })
  18. .then(function (user) {
  19. xhttp.open("GET", "http://localhost:8080/api/users/" + user.id, true);
  20. xhttp.send();
  21. })
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement