×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Added: Dec 4, 2021 7:32 AM
Views: 881
Tags: no tags
  1. methods: {
  2.   async fetchSomething() {
  3.     const ip = await this.$axios.$get('http://icanhazip.com')
  4.     this.ip = ip
  5.   }
  6. }
  7.  
  8. // with headers
  9. this.$membersApi.get('/people/1', {
  10.     headers: {
  11.         Authorization: `Bearer ${token}`,
  12.     },
  13. })
  14.  
  15. // Normal usage with axios
  16. let data = (await $axios.get('...')).data
  17.  
  18. // Fetch Style
  19. let data = await $axios.$get('...')