javascript - Meteor Mongo, and Flow Router -
i started using meteorjs (required job), , i'm having issue meteor mongo , flow router working together. when load page externally fetches data mongo returns empty, if go route through links internally on application (after inserting stuff mongo) doesn't return empty. i'm using auto publish, don't think subscription issue. please <3
flowrouter.route('/assessment/:token/:admin', { action: function(params, queryparams) { var test = tests.find({token: params.token}).fetch(); if(test[0] === undefined) return blazelayout.render('app', {content: '404'}); // if admin page if(params.admin && test[0].admin === params.admin) { var scores = scores.find({assessment: test[0].token}, {sort: {createdat: -1}}).fetch() , sum = 0; scores.foreach(s => sum += s.score); var mean = sum / scores.length; session.set('scores.list', scores); session.set('scores.sum', sum); session.set('scores.mean', mean); return blazelayout.render('app', {content: 'admin'}); } // take test session.set('assessment', test[0]); blazelayout.render("app", {content: "take"}); } })
Comments
Post a Comment