-1👍
✅
Update: Do not refer to the code below the line. It’s clearly the promise construction anti pattern I wasn’t aware of. So some edge cases might not be handled.
Use response = axios.get(url).then(({ data }) => data)
Instead.
================================================================
Just found out seconds after I posted this question lol(& as @Phil has pointed out). Since there is no response
in the call, simply removing it would do the trick:
result = new Promise((resolve, reject) => {
axios.get(url)
.then((response) => {
const processedData = response.data.map((v) => {
return v;
})
resolve(processedData);
}).catch((error) => {
if(typeof(error) == 'object'){
alert(error)
}
reject(error.data);
});
});
Source:stackexchange.com