fraction/news

View on GitHub
app/packages/fraction-routes/lib/routes/recent.next.js

Summary

Maintainability
B
6 hrs
Test Coverage
'use strict';

Routes.recent = {
  name: 'recent',
  controller: Routes.Controllers.news,
  path:     '/recent',
  waitOn: () => {
    return Meteor.subscribe('recentPosts');
  },
  onAfterAction: () => {
    Routes.setNews('recent');
    Session.set('findSelector', {});
    Session.set('findOptions', {
      reactive: false,
      sort: {
        createdAt: -1
      }
    });
    Session.set('posts', Posts.find(
      Session.get('findSelector'),
      Session.get('findOptions')
    ).fetch());
  }
};