0👍
You can change your export to be a method that accepts an URL and call it when you need to update it
const createAxios = (proxyURL) => {
axios.create({
baseURL: 'http://127.0.0.1',
proxy: {
'/api/': 'http://127.0.0.1',
'/w0w/': proxyURL || 'http://192.168.1.12'
}
})
}
export default createAxios
Now you need to call it a bit differently
Vue.prototype.$axios = axios(/*or custom proxy url here*/);
- [Vuejs]-Is it possible to change the value of a prop in a vue component from methods
- [Vuejs]-VueJS – Post array of object using jquery $.ajax
Source:stackexchange.com