I am trying to figure out this one weird issue with dealing with this promise. I have done my fair share of promises so I am not new to it, but with this one function, it is really weird.
const getTrades = () => {
const accountId = accounts.find(account => account.type === 'INTERNAL').id;
const response = showTrades({ accountId: accountId }).then(res => console.log(res))
if (response.length === 0) return false;
return true;
};
So the console log of the response above yields an empty array, which is expected. So if the array is empty, it should return false, otherwise it should return true. However, when I call the function like this, it just returns a Promise object.
getTrades()
Anyone know what could be causing this and how to solve this? Thanks!