Cannot read property 'get' of undefined on local host

Viewed 177

Using Vue.Js, when I try to run on local host, I get an error of Cannot read property 'get' of undefined

It is referring to my.get request. Any advice?

export default {
  asyncData({ $axios }) {
   return $axios.get('https://jsonplaceholder.typicode.com/todos/1')
     .then(response => {
      return { posts: response.data }
    })

},
1 Answers

It should be like this

asyncData({ $axios }) { return $axios.$get('https://jsonplaceholder.typicode.com/todos/1') .then(response => { return { posts: response.data } }) },

Add $get

Related