I'm trying to prevent navigating to most of my sites' pages when user is not yet logged in. So this is the code I started to write to solve that issue:
router.on("router:navigation:processing", function (instruction, usedRouter) {
if (!userLoggedIn && instruction.config.moduleId !== "login") {
router.navigate('login'); //no better way???
}
}
I would like to find a better alternative to the "router.navigate()"... Didn't find any instruction.cancelNavigation() or anything like that...
OK, linked to Conditional routing in Durandal (see how to code it and the official doc about it)
Thanks @Matthew !