Closed sundowndev closed 3 years ago
By simply looking at https://github.com/nuxt/http/blob/master/lib/plugin.js#L17
You should be able to use this.$http._defaults.prefixUrl
. What would be the usage of accessing the baseURL
?
By simply looking at https://github.com/nuxt/http/blob/master/lib/plugin.js#L17
You should be able to use
this.$http._defaults.prefixUrl
. What would be the usage of accessing thebaseURL
?
Let's say I have a property url
from my REST API, I'd like this url be a link in my template. Problem is this URL is not always absolute (e.g: /uploads/123.pdf). So I need a way to use the prefixUrl when needed.
this.$http._defaults.prefixUrl
does not seem to have a TS signature, this is intended to be a private property, isn't it?
We never had the case to expose it honestly. I guess we can add a getter for it, what do you think @pi0 ?
PR welcome to expose $http.baseURL
but generally it would be much better if exposing baseURL via runtime config ($config.baseURL
) to generate such links instead of depending on http client instance
Fixed by #165
Hi, I need to access baseURL property in a template, is it possible to add a getter for it?
Thanks