I am trying to write a method that uses the scryfall sdk to get a card by name. However the problem is, that the method does not return any value. The console.log is working, but the tempResult variable never gets a value and always returns an empty string. I guess I am doing something wrong with the lambda function but I dont know what.
public getCardsByCardNameFromScryfall(cardName) : any{
var tempResult;
Scry.Cards.byName(cardName, true).then(result => {
console.log(result.name);
tempResult = result.name;
});
return tempResult;
}
Does anybody have an idea? Thank you :)