[Vuejs]-Subscribing to autopublish (for navigation guard)

0👍

So the way I usually handle these issues is by passing the cursors as data through Iron Router and check if the data is available. For example:

Router.route('/', {
    waitOn: [
        function() {
            if (!Meteor.userId()) {
                Router.go('/login');
            }
            return Meteor.subscribe('data');
        }
    ],
    action: function() {
        this.render('template');
    },
    data: function() {
        return {
            data: Data.find({})
        };
    }
})
<template name="template">
  {{#if data}}
    ...
  {{/if}}
</template>

Let me know if this works.

Edit:
just noticed the tag for a different router

Leave a comment