Nuxt.js: How to using axios.baseUrl in asyncData function

Created on 19 May 2019  路  2Comments  路  Source: nuxt/nuxt.js

What problem does this feature solve?

Hi,

I want to call backend api by using relative path by axios.get(relativePath) function
But since we cannot access this.$axios... from asyncData function, so axios.baseURL config cannot working here , right ?

How to do that ?

This feature request is available on Nuxt community (#c9237)
feature-request

Most helpful comment

You can. asyncData is passed context and axios can be gotten from context.$axios

All 2 comments

You can. asyncData is passed context and axios can be gotten from context.$axios

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gary149 picture gary149  路  3Comments

vadimsg picture vadimsg  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments

uptownhr picture uptownhr  路  3Comments

pehbehbeh picture pehbehbeh  路  3Comments