Answer the question
In order to leave comments, you need to log in
How to catch a router transition in Framework7?
Hey! Is there an analogue of router.beforeEach() in Framework7 in routers?
It is necessary if the user is logged out to redirect him to the authorization form.
Answer the question
In order to leave comments, you need to log in
https://framework7.io/docs/view.html#router-instan...
documentation, no?
In main.js
mounted () {
this.$f7.view.main.router.on('pageBeforeIn', function () {
if (userSignIn) {
console.log('авторизован');
} else {
console.log('не авторизован, редиректим на логин пэйдж');
this.$f7.view.main.router.navigate('/login/',{reloadCurrent: true});
}
});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question