I am hosting express server with steam accounts intstances abd currently having troubles with getOffer method callback. Im not experienced enough to work with callbacks, and google answers are not really suited for my problem, so I would like to ask your help here.
The code below is the functions that is executed on a get request. It calls custom function inside account instance's
app.get('/tradeOffer', auth, async (req, res) => {
let { offerID, username } = req.query;
await accounts[username].getOffer(offerID)
.then(offer => {console.log("Offer", offer)})
.catch(error => console.log(error))
res.status(200).json()
})
This code is a snippet of a methods inside account's instance
getOffer = async (offerID) => {
console.log("Getting trade offer", offerID);
this.manager.getOffer(offerID, (err, offer) => {
if(err) return err;
return offer;
})
}
The question is - how do I respond, lets say, with an offer ID on a request?
Thanks in advance