Guest User

Untitled

a guest
Jul 2nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. export default {
  2. name: 'home',
  3.  
  4. data: function() {
  5. return {token: ''}
  6. },
  7.  
  8. methods: {
  9. fetchData() {
  10.  
  11. this.$http({
  12. method: 'get',
  13. url: 'URL_TO_SERVER',
  14.  
  15. auth: {
  16. username: 'USERNAME',
  17. password: 'PASSWORD'
  18. },
  19. headers: {
  20. 'Access-Control-Allow-Origin': '*',
  21. credentials: 'same-origin',
  22. },
  23. withCredentials: true,
  24. }).then((response) => {
  25. console.log(response.data);
  26. }).catch((error) => {
  27. console.log('ERROR: '+ error.response.data);
  28. });
  29. }
  30. }
  31. }
Add Comment
Please, Sign In to add comment