Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _db.getUser(sessionId, function(err, user) {
- if (!user.id) return;
- var profilePromise = Q.Promise(function(res, rej) {
- _db.getProfile(user.id, function(err, profile) {
- if (err) return rej(err);
- res(profile);
- });
- });
- var galleryPromise = Q.Promise(function(res, rej) {
- _db.getGalleries(user.id, function(err, gallery) {
- if (err) return rej(err);
- res(gallery);
- });
- });
- Q.all([profilePromise, galleryPromise]).spread(function(profile, gallery) {
- if (!profile || !gallery) return;
- var viewModel = {
- profile: profile,
- gallery: gallery
- };
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment