Reputation: 492
I set axios.default.baseUrl
to the api subdomain of a local project. When making requests from the admin subdomain of the site, axios does not prepend the baseUrl.
Instead, it sends the request to admin.example.test (in my case, 'example' is 'loa'. You can see it in the image below).
How to make axios prepend the default baseUrl in every request? So that I don't have to write something like axios(axios.defaults.baseUrl + url)
.
Upvotes: 1
Views: 698
Reputation: 492
Instead of axios.defaults.baseUrl = "http://api.example.test"
, it should be axios.defaults.baseURL = "http://api.example.test"
.
I felt kind of stupid for not seeing this. But I will answer my own question because maybe it can help somebody who has the same problem.
Upvotes: 1