I’ve been using this.$f7router.navigate("/home"); in many methods and it’s working perfectly, however I just implemented the Login in the app.
So basically when someone is already logged in, the login.vue detects the cookie and redirets to home.
I do get redirected to home, however the app gets frozen, only way to unfreeze it is on a Browser (while debugging), and manage to get into the left sidebar and change the view from there, which is impossible to do from a normal phone due the resolution.
This is my methods on login.vue.
methods: {
login() {
let logUser = {
email: this.email,
password: this.password
}
console.log(logUser)
Authentication.authenticate(this, logUser, null)
},
checkLoggedin(){
console.log("Checking...");
if(this.$cookies.isKey("sometoken")){
console.log("autentificado")
this.$f7router.navigate("/home");
} else{
console.log("No autentificado")
}
}
},
mounted() {
this.checkLoggedin();
}
As I said, navigate works well in any other circumstance, but in this one specifically it won’t.
Edit: If I place it on a timer, say, 3 seconds after checking if Logged in it works just fine, I think it’s related to Vue lifecycle, of course waiting a fixed amount of time ain’t a good solution IMO.