kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 195 forks source link

triggers except not working? #557

Open nilnullzip opened 8 years ago

nilnullzip commented 8 years ago

I can't seem to get the triggers except option working. This example should not invoke loginCheck() when visiting the '/' route. However the console.log message is always printed.

loginCheck = (context, redirect, stop)->
  console.log "foo", FlowRouter.current().path

FlowRouter.triggers.enter [loginCheck], except: ["/"]
acomito commented 8 years ago

I do mine like this:

FlowRouter.triggers.enter([function(context, redirect){

    if(!Meteor.userId()) {
        FlowRouter.go('login');
    }

}], {except: [
    "sign-up",
    "login",
    "LandingPage",
]});

Did you try it with the "name" of the "/" route instead of the url path? so, name the "/" path somethign like "home" or "login" and pass that in?