Closed ThePeach closed 4 years ago
HI @ThePeach
Do you mind showing us some code of what you are trying to achieve please? :)
hi @Atinux. sorry for this late reply but my inbox is swamped and it's hard to keep track of replies for some reason I'm not getting notified.
Anyhow the problem I've faced is that the baseUrl
variable will need to be defined at build time, and can't be updated dynamically at runtime. The main objective for me is in a universal
app, in conjunction with nuxt-env
module, in order to have a "build one, run everywhere" type of app.
I hope this makes sense.
Actually if you use nuxt start, you can use the proxy of axios and set the proxied url on tu time directly :)
With v0.5.0, you can now use $http.setBaseURL.
This way, you can create a plugin to set the baseURL based on something like ˋ$store.state.baseURL` combined with nuxtServerInit where you can get access to server env.
What problem does this feature solve?
this is very much a runtime/environment variable issue. In order to use variables defined by nuxt-env, I would have to have access to the
app
object. This is something currently doable with the axios moduleWhat does the proposed changes look like?
the
config
object should have have abaseURL
variable, and the final url shouldn't be computed already.