पर लॉग इन किया है, ऐसा लगता है कि Deps.autorun जाने का रास्ता है लेकिन Router.go Deps.autorun के भीतर काम नहीं कर रहा है। एक उपयोगकर्ता index
पृष्ठ पर है और वह में लॉग इन किया है, तोउपयोगकर्ता ने अभी लॉग इन किया है या सिर्फ
Router.configure({layoutTemplate: 'layout'});
Router.map(function() {
this.route('index', {path: '/'});
this.route('signin');
this.route('dashboard');
});
var mustBeSignedIn = function(pause) {
if (!(Meteor.user() || Meteor.loggingIn())) {
Router.go('signin');
} else {
this.next();
}
};
var goToDashboard = function(pause) {
if (Meteor.user()) {
Router.go('dashboard');
} else {
this.next();
}
};
Router.onBeforeAction(mustBeSignedIn, {except: ['signin']});
Router.onBeforeAction(goToDashboard, {only: ['index']});
, वह स्वचालित रूप से dashboard
पेज पर ले जाया जाएगा: index
, signin
और dashboard
:
'goToPick' क्या है? – Warz
यह एक टाइपो था। यह बात बताने के लिए धन्यवाद। –
इस दृष्टिकोण का उपयोग करके, आपको एक खाली टेम्पलेट अनुक्रमणिका बनाने की आवश्यकता है। सही? अन्यथा, उल्का एक अपवाद फेंकता है। –