我所有的路线运行良好,我的路线在"D:\test\imports\startup\client\routes.js".中声明。
当注销模块完美运行时,onLogin()调用重定向到页面,但使用"FlowRouter.notFound“操作。
下面是我成功登录时返回的页面。

怎样才能重定向到正确的路径而不是'notFound‘路径?
-------------UPDATED-------------
PROJECT\imports\startup\client\routes.js
var clientRoutes = FlowRouter.group({
prefix: '/client',
name: 'client',
triggersEnter: [function(context, redirect) {
if(!Meteor.userId()){FlowRouter.go('/');}
console.log('/Client route called.');
}]
});
clientRoutes.route('/', {
name: 'client-dashboard',
action: function() {
console.log("Dashboard called.");
BlazeLayout.render('App_AuthClient', { main : 'App_UserDashboard'});
}
});发布于 2017-05-17 12:05:45
更新
在更新了问题后,出现了client是FlowRouter组的名称,而不是路由名,它是client-dashboard,应该用于重定向用户。
由于您使用的是FlowRouter,所以我建议采用以下方法:
因此,FlowRouter将处理基于Meteor.userId cookie值的重定向。
而您被重定向到404的原因是,我想没有定义名称"client“的路由。
https://stackoverflow.com/questions/44001688
复制相似问题