Jump to content
McKay Development

Recommended Posts

Posted (edited)
offer object and the id are provided correctly... for some reason the id of the offer is null.

 

function sendOffer(offer, id){
offer.setMessage("xxx");
offer.send();
var oid = offer.id;
updateTrade("send", id, oid);
console.log(oid);
}
 
function updateTrade(status, id, offerId){
mysqlConnection.query('UPDATE trades SET status = "'+ status +'", offerId = "'+ offerId +'" WHERE id = ' + id, function(err, row, fields) {
if(err){
console.log(err);
return;
}
});
console.log("Trade Offer Done");
Edited by pumble
Posted

could it be a problem based on the asynch style of node and the send function takes to long time to set the id ?

 

but why doest this just happen after ive updated to v2 ?

Posted

could it be a problem based on the asynch style of node and the send function takes to long time to set the id ?

 

but why doest this just happen after ive updated to v2 ?

 

Yes, most certainly. You need to wait for the callback of send().

 

I have no idea why it worked before v2. My guess is that it didn't. The code you just posted would never work.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...