After the underPrice function call, it goes straight to the next promise call and returns undefined, then goes to under price. I am not sure what I am doing wrong any help would be really appreciated. The data is there as undrPrice gets the keys and if I put a console.log - it prints it out. The issues is the second then statement goes off without the first one being done```` /// grab all onlinevar getActiveData = (payload) => { pub.smembers('partner:services:' + payload.services) .then((data) => { Promise.all(data.map(underPrice.bind(this, payload))) }) .then((data) => { Promise.all(console.log(data)); });}; ```` Here is the underPrice codevar underPrice = (payload, key) => { return new Promise((resolve, reject) => { pub.hmget(key + ":services:" + payload.services, "amount", (err, data) => { if (err) reject(err); //will display '1, 3, 5, 7' else { data <= payload.price ? resolve(key) : reject(key); } }); }); };
Submitted February 01, 2018 at 04:08PM by instaWalkin
No comments:
Post a Comment