我使用流星與FlowRouter,我在尋找這樣一個條件:FlowRouter重定向如果用戶登錄,如果路徑是
- 如果用戶登錄& &如果訪問路徑http://x.x.x.x/
- 然後重定向到http://x.x.x.x/clients
我目前的路線:
Accounts.onLogin(function(){
FlowRouter.go('clients');
});
Accounts.onLogout(function(){
FlowRouter.go('home')
});
FlowRouter.triggers.enter([function(context, redirect){
if(!Meteor.userId()){
FlowRouter.go('home')
}
}]);
FlowRouter.route('/', {
name: 'home',
action(){
BlazeLayout.render('HomeLayout');
}
});
FlowRouter.route('/clients',{
name: 'clients',
action(){
BlazeLayout.render('MainLayout', {main: 'Clients'});
}
});