Closed teckel12 closed 3 years ago
I'm missing something really basic and it's as if axios is not being loaded. I did the following:
npm install --save @nuxtjs/axios
nuxt.config.js
export default { modules: [ '@nuxtjs/axios' ] }
export default { methods: { async test() { const ip = await this.$axios.$get('http://icanhazip.com') this.ip = ip }, } }
When I call the test() method I get the title error as if axios can't be found. If I do a await this.$axios({ ... }) I get the following:
test()
await this.$axios({ ... })
TypeError: _this.$axios is not a function
So sure enough, it can't find axios. Any idea what I missed? I seem to be following the install and setup from https://axios.nuxtjs.org/setup
Hi @teckel12. It is hard to figure out the issue from the description above. If you can share project or provide a reproduction can help.
I'm missing something really basic and it's as if axios is not being loaded. I did the following:
npm install --save @nuxtjs/axios
which successfully installs nuxtjs/axios v5.13.1nuxt.config.js
I added:When I call the
test()
method I get the title error as if axios can't be found. If I do aawait this.$axios({ ... })
I get the following:TypeError: _this.$axios is not a function
So sure enough, it can't find axios. Any idea what I missed? I seem to be following the install and setup from https://axios.nuxtjs.org/setup