I have two functions to get an item's name.
getItemName(itemId) {
getSingleItem(itemId)
.then(item => {
return item.Name;
});
}
getSingleItem(itemId) {
return httpsRequest.createRequest(this.URL.itemList + `?Item_Id=${it}`, {}, this.requestHeaders, 'GET')
.then(result => JSON.parse(result).Records[0]);
}
So it seems that getItemName() finishes execution before the item.Name can be returned. Is the only way to get this to return correctly to wrap it in a promise, and change the return statement to resolve(item.Name)? Or is there a cleaner way to do this? Thanks!