I’m using Framework7 (3.5) for a while and every time I get crazy because of documentation.
I need to do a simple redirect if the user is logged in. The user informations are stored on Local Storage. So I perform this on pageInit
function of my page:
user= window.localStorage.getItem("user")
if(user == null){
console.log("User doesn't exist")
app.router.navigate('/login/', {reloadAll: true});
}
else{
console.log("User exist")
app.router.navigate('/home/', {reloadAll: true});
}
So the log messages work fine, but the app.router.navigate are totaly ignored by the framework. The routes are create in the right way on myApp.js
(already tested) and the app.router.navigate
works only if I use Dom7('#random-button').on('click, function(){})
.
If I trigger the onClick
function the redirect works, without no.
Any idea why?