Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. // fetching datas
  2. methods: {
  3. getDataAgents : function(){
  4. let items = this
  5. let url = 'http://localhost:3000/stokiest'
  6. axios.get(url)
  7. .then(function(res){
  8. items.agents = res.data
  9.  
  10. console.log(res.data)
  11. })
  12. .catch(function(err) {
  13. console.log(err)
  14. })
  15. }
  16. },
  17. getByid : function(id){
  18. let item = this;
  19. let url = 'http://localhost:3000/stokiest/' + id
  20. axios.get(url)
  21. then(function(res) {
  22. console.log(res)
  23. })
  24. }
  25. };
  26.  
  27. component
  28.  
  29. <v-btn color="success" v-on:click="getByid">Get data Agent</v-btn>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement