0👍
As @Romalex already commented, you created an axios object with a base Url, but you don’t use it.
import axios from 'axios'
const api = axios.create({
baseURL: 'http://localhost:3000/',
headers: {
"Content-Type": "application/json"
}
});
export default api;
Give the object a name, export it, and use it in your application instead of the axios object
Example:
async getData() {
return await api.get('/data/1');
}
Source:stackexchange.com