I am trying to get the values from axios get request that is in a function stored in another file postData.js
const BaseURL = 'http://127.0.0.1:8000/api/';
export const getData = (location) => {
return axios.get(`${BaseURL}${location}`).then(res => res.data)
.then((data) => {
return data;
})
}
From console.log(getData('menu/')), inside the component of other file I expect the values from the axios rather I am getting a promise object.