I have simple structure , /
/login
/main
routes, when I signin, I must go to /main
but routes go to /main
and after redirect me to /
var mySubmitFunc = function(error, state){
if (!error) {
if (state === "signIn") {
FlowRouter.go('main');
}
}
};
var myPostLogout = function(){
FlowRouter.go('/login');
};
AccountsTemplates.configure({
onLogoutHook: myPostLogout,
onSubmitHook:mySubmitFunc,
});
and router
AccountsTemplates.configure({
defaultTemplate: 'fullPageAtForm',
defaultLayout: 'homeLayout',
defaultLayoutRegions: {},
defaultContentRegion: 'main'
});
AccountsTemplates.configureRoute('enrollAccount');
AccountsTemplates.configureRoute('signIn', {
name: 'signin',
path: '/login'
});
FlowRouter.route('/', {
name: "home",
action: function() {
BlazeLayout.render('homeLayout',{main : 'home'});
},
});
FlowRouter.route('/main', {
name: "main",
action: function() {
BlazeLayout.render('mainLayout',{main : 'main'});
},
});
but when I add this
Meteor.defer(function( ) {
FlowRouter.go('main');
});
All woks fine, so can some one explaine?